2026-08-27 10:09:54 +08:00
|
|
|
package log
|
|
|
|
|
|
|
|
|
|
type LogConf struct {
|
|
|
|
|
Level string `json:",default=INFO"` // 日志级别: DEBUG, INFO, WARN, ERROR
|
|
|
|
|
Format string `json:",default=text"` // 日志格式: text, json
|
|
|
|
|
TimeFormat string `json:",default=2006-01-02 15:04:05"` // 时间格式
|
|
|
|
|
Filename string `json:",default=spcm.log"` // 日志文件名
|
2026-08-28 09:22:19 +08:00
|
|
|
Daily bool `json:",default=true"` // 按天存储: 文件名追加日期,跨天自动切换
|
2026-08-27 10:09:54 +08:00
|
|
|
MaxSize int `json:",default=100"` // 单个日志文件最大大小(MB)
|
|
|
|
|
MaxBackups int `json:",default=10"` // 保留的旧日志文件数量
|
|
|
|
|
MaxAge int `json:",default=30"` // 日志文件保留天数
|
|
|
|
|
Compress bool `json:",default=true"` // 是否压缩旧日志文件
|
|
|
|
|
Console bool `json:",default=false"` // 是否同时输出到控制台
|
|
|
|
|
AddSource bool `json:",default=false"` // 是否在日志中添加文件名和行号
|
|
|
|
|
Stats bool `json:",default=false"`
|
|
|
|
|
}
|