* - 修复issues #1118 - zap日志无法按照等级出现在对应log文件中 - zap.AddCaller()只有在global.GVA_CONFIG.Zap.ShowLine为true才生效 - rotatelogs.ForceNewFile(),取消这个, 这样每次启动不会出现同一天日志级别.1后缀的新文件 * 等级使用Transport进行转换,优化臃肿代码,优雅获取zapcore.Core
This commit is contained in:
@@ -18,7 +18,6 @@ type fileRotatelogs struct{}
|
||||
func (r *fileRotatelogs) GetWriteSyncer(level string) (zapcore.WriteSyncer, error) {
|
||||
fileWriter, err := rotatelogs.New(
|
||||
path.Join(global.GVA_CONFIG.Zap.Director, "%Y-%m-%d", level+".log"),
|
||||
rotatelogs.ForceNewFile(),
|
||||
rotatelogs.WithClock(rotatelogs.Local),
|
||||
rotatelogs.WithMaxAge(time.Duration(global.GVA_CONFIG.Zap.MaxAge)*24*time.Hour), // 日志留存时间
|
||||
rotatelogs.WithRotationTime(time.Hour*24),
|
||||
|
Reference in New Issue
Block a user