2
0
mirror of https://gitee.ltd/lxh/logger.git synced 2026-05-25 07:41:15 +08:00

🎨 优化日志用法

This commit is contained in:
李寻欢
2022-05-18 17:43:19 +08:00
parent 3ea919e06c
commit 27dd190fbd
4 changed files with 80 additions and 6 deletions

View File

@@ -47,7 +47,7 @@ func InitLogger(c LogConfig) {
// 增加 caller 信息
// AddCallerSkip 输出的文件名和行号是调用封装函数的位置,而不是调用日志函数的位置
logger := zap.New(zapcore.NewTee(cores...), zap.AddCaller())
logger := zap.New(zapcore.NewTee(cores...), zap.AddCaller(), zap.AddCallerSkip(1))
Say = logger.Sugar()
zap.ReplaceGlobals(logger)
}