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:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user