增加真是逻辑行号的打印

This commit is contained in:
zhangdeman committed 2021-03-05 00:18:18 +08:00
1 parent 9b861374e3
commit fd20f828fe
1 file changed
+2 -1
+2 -1
View File
@@ -60,7 +60,8 @@ func NewLogger(loggerLevel zapcore.Level, consoleOutput bool, encoder zapcore.En
// 最后创建具体的Logger
core := zapcore.NewTee(fileHandlerList...)
log := zap.New(core, zap.AddCaller()) // 需要传入 zap.AddCaller() 才会显示打日志点的文件名和行数
// 需要传入 zap.AddCaller() 才会显示打日志点的文件名和行数, 跳过一行可以直接显示业务代码行号,否则显示日志包行号
log := zap.New(core, zap.AddCaller(), zap.AddCallerSkip(1))
return log, nil
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.