From b3287bda4661c09f29b851c329fca27a1517022e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 12 Jun 2025 06:15:46 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20=E8=87=AA=E5=8A=A8=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E5=8C=96=E4=BB=A3=E7=A0=81=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/logger.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/common/logger.py b/src/common/logger.py index 1e281dd6c..0ad9da190 100644 --- a/src/common/logger.py +++ b/src/common/logger.py @@ -101,7 +101,7 @@ def configure_logging( """动态配置日志参数""" log_path = Path(log_dir) log_path.mkdir(exist_ok=True) - + # 更新文件handler配置 root_logger = logging.getLogger() for handler in root_logger.handlers: @@ -109,18 +109,19 @@ def configure_logging( handler.maxBytes = max_bytes handler.backupCount = backup_count handler.baseFilename = str(log_path / "app.log.jsonl") - + # 设置日志级别 root_logger.setLevel(getattr(logging, level.upper())) + def format_json_for_logging(data, indent=2, ensure_ascii=False): """将JSON数据格式化为可读字符串 - + Args: data: 要格式化的数据(字典、列表等) indent: 缩进空格数 ensure_ascii: 是否确保ASCII编码 - + Returns: str: 格式化后的JSON字符串 """