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
@@ -6,6 +6,10 @@ server:
mode: debug
max_file_size: 10485760 # 10MB
log:
level: info # debug / info / warn / error
format: text # text / json
database:
dsn: "data/gen2d.db"