feat(logger): implement LLM debug logging functionality

- Added a new logger for LLM calls, enabling detailed logging of model interactions, including request and response data.
- Introduced configuration options for enabling and specifying the log directory for LLM debug logs.
- Implemented cleanup for old log files to manage disk space effectively.
- Wrapped existing chat implementations to log calls when debug logging is enabled, enhancing traceability for model interactions.
This commit is contained in:
wizardchen
2026-04-16 22:39:10 +08:00
committed by lyingbug
parent 6235a82183
commit 53e8e17df4
22 changed files with 1304 additions and 265 deletions
+4
View File
@@ -14,6 +14,10 @@ GIN_MODE=release
# 日志级别,可选值:debug, info, warn, error, fatal,默认为debug
# LOG_LEVEL=debug
# LLM 调试日志:将每次大模型调用的完整请求和响应写入独立日志文件,便于排查上下文问题
# 可选值:true(自动放在 LOG_PATH 同目录下 llm_debug.log)、false/空(关闭)、或指定文件路径
# LLM_DEBUG_LOG=true
# 时区设置,默认为 Asia/Shanghai
# 影响系统时间显示和日志时间戳
# 常用值:Asia/Shanghai, Asia/Tokyo, America/New_York, Europe/London, UTC