From a987902f7280936d8e7a9bd72c19e9604853f390 Mon Sep 17 00:00:00 2001 From: liuwei Date: Fri, 16 Jan 2026 13:22:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4log=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/dashboard/blueprints/system.py | 2 +- main.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/dashboard/blueprints/system.py b/admin/dashboard/blueprints/system.py index 3727ea8..9143834 100644 --- a/admin/dashboard/blueprints/system.py +++ b/admin/dashboard/blueprints/system.py @@ -68,7 +68,7 @@ def api_wx_logs(): lines = request.args.get('lines', 100, type=int) # 默认显示最后100行 # 修正日志文件路径计算,获取项目根目录 - project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..')) + project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..','logs')) if log_type == 'error': log_file = os.path.join(project_root, 'wx_error.log') diff --git a/main.py b/main.py index a079f02..f9074eb 100644 --- a/main.py +++ b/main.py @@ -15,7 +15,7 @@ from utils.sehuatang.sehuatang_bot import SehuatangCrawler # INFO 日志(包含 INFO、DEBUG,但不包含 WARNING、ERROR) logger.add( - f"wx_info.log", + f"logs/wx_info.log", level="INFO", filter=lambda record: record["level"].name in ["INFO", "DEBUG"], rotation="10 MB", @@ -25,7 +25,7 @@ logger.add( # ERROR 日志(仅 ERROR 及以上) logger.add( - f"wx_error.log", + f"logs/wx_error.log", level="ERROR", rotation="10 MB", retention="7 days", @@ -33,7 +33,7 @@ logger.add( ) # ERROR 日志(仅 ERROR 及以上) logger.add( - f"wx_debug.log", + f"logs/wx_debug.log", level="DEBUG", rotation="10 MB", retention="7 days",