From d3f2cce9223735c4d7e7bd1103edbb368568f998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=96=87=E8=96=87=E5=AE=89?= Date: Sun, 1 Feb 2026 22:49:07 +0800 Subject: [PATCH] a --- backend/api/routes/system.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backend/api/routes/system.py b/backend/api/routes/system.py index 1bc4c37..a794431 100644 --- a/backend/api/routes/system.py +++ b/backend/api/routes/system.py @@ -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