feat(log): 新建 logger 包,基于 log/slog 提供结构化日志

- 新建 internal/logger/logger.go,提供 Init/FromCtx/WithRequestID 方法
- Config 新增 LogConfig(level/format),支持 GEN2D_LOG_LEVEL/GEN2D_LOG_FORMAT 环境变量
- config.yml 和 .env.example 添加日志配置示例
This commit is contained in:
2026-05-25 14:30:35 +08:00
parent 50f95adb98
commit fb0d83251f
4 changed files with 92 additions and 0 deletions
+4
View File
@@ -5,6 +5,10 @@
GEN2D_PORT=8080
GEN2D_MODE=debug
# 日志配置
GEN2D_LOG_LEVEL=info # debug / info / warn / error
GEN2D_LOG_FORMAT=text # text / json
# SQLite 数据库路径
GEN2D_DSN=data/gen2d.db