a
This commit is contained in:
parent
8ff8cd4ebc
commit
d3f2cce922
|
|
@ -332,6 +332,12 @@ async def get_logs(
|
|||
if start < 0:
|
||||
start = 0
|
||||
|
||||
# 定义管理员不需要关注的日志模式(噪声过滤)
|
||||
IGNORED_PATTERNS = [
|
||||
"API密钥未配置",
|
||||
"请在配置界面设置该账号的BINANCE_API_KEY",
|
||||
]
|
||||
|
||||
group = (group or "error").strip().lower()
|
||||
if group not in LOG_GROUPS:
|
||||
raise HTTPException(status_code=400, detail=f"非法 group:{group}(可选:{', '.join(LOG_GROUPS)})")
|
||||
|
|
@ -388,6 +394,12 @@ async def get_logs(
|
|||
continue
|
||||
if level and str(parsed.get("level")) != level:
|
||||
continue
|
||||
|
||||
# 噪声过滤
|
||||
msg = str(parsed.get("message", ""))
|
||||
if any(p in msg for p in IGNORED_PATTERNS):
|
||||
continue
|
||||
|
||||
items.append(parsed)
|
||||
if len(items) >= limit:
|
||||
break
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user