优化日志输出选项
This commit is contained in:
parent
d6fb8d43c9
commit
eceacfd88f
@ -15,6 +15,7 @@ func newSys(options *Options) (sys *Logger, err error) {
|
|||||||
CupTime: time.Duration(options.CupTimeTime) * time.Hour, //日志切割间隔时间
|
CupTime: time.Duration(options.CupTimeTime) * time.Hour, //日志切割间隔时间
|
||||||
Compress: options.Compress, //是否压缩 disabled by default
|
Compress: options.Compress, //是否压缩 disabled by default
|
||||||
MaxBackups: options.MaxBackups, //最大备份数
|
MaxBackups: options.MaxBackups, //最大备份数
|
||||||
|
MaxSize: options.MaxSize, //最大日志文件大小
|
||||||
LocalTime: true, //使用本地时间
|
LocalTime: true, //使用本地时间
|
||||||
}
|
}
|
||||||
if !options.IsDebug {
|
if !options.IsDebug {
|
||||||
|
@ -24,6 +24,7 @@ type Options struct {
|
|||||||
CupTimeTime int //日志分割时间 单位 小时
|
CupTimeTime int //日志分割时间 单位 小时
|
||||||
MaxAgeTime int //日志最大保存时间 单位天
|
MaxAgeTime int //日志最大保存时间 单位天
|
||||||
MaxBackups int //最大备份日志个数
|
MaxBackups int //最大备份日志个数
|
||||||
|
MaxSize int //最大文件大小
|
||||||
Compress bool //是否压缩备份日志
|
Compress bool //是否压缩备份日志
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +101,7 @@ func newOptions(config map[string]interface{}, opts ...Option) (options *Options
|
|||||||
CupTimeTime: 24,
|
CupTimeTime: 24,
|
||||||
MaxAgeTime: 7,
|
MaxAgeTime: 7,
|
||||||
MaxBackups: 250,
|
MaxBackups: 250,
|
||||||
|
MaxSize: 100 * 1024 * 1024,
|
||||||
Compress: false,
|
Compress: false,
|
||||||
Encoder: TextEncoder,
|
Encoder: TextEncoder,
|
||||||
CallerSkip: 3,
|
CallerSkip: 3,
|
||||||
|
Loading…
Reference in New Issue
Block a user