优化日志输出选项

This commit is contained in:
liwei1dao 2022-12-02 16:31:46 +08:00
parent d6fb8d43c9
commit eceacfd88f
2 changed files with 3 additions and 0 deletions

View File

@ -15,6 +15,7 @@ func newSys(options *Options) (sys *Logger, err error) {
CupTime: time.Duration(options.CupTimeTime) * time.Hour, //日志切割间隔时间
Compress: options.Compress, //是否压缩 disabled by default
MaxBackups: options.MaxBackups, //最大备份数
MaxSize: options.MaxSize, //最大日志文件大小
LocalTime: true, //使用本地时间
}
if !options.IsDebug {

View File

@ -24,6 +24,7 @@ type Options struct {
CupTimeTime int //日志分割时间 单位 小时
MaxAgeTime int //日志最大保存时间 单位天
MaxBackups int //最大备份日志个数
MaxSize int //最大文件大小
Compress bool //是否压缩备份日志
}
@ -100,6 +101,7 @@ func newOptions(config map[string]interface{}, opts ...Option) (options *Options
CupTimeTime: 24,
MaxAgeTime: 7,
MaxBackups: 250,
MaxSize: 100 * 1024 * 1024,
Compress: false,
Encoder: TextEncoder,
CallerSkip: 3,