From 39068c1af2fcf1e5fa8b18516dd46c1c30a52f51 Mon Sep 17 00:00:00 2001 From: sanxun0325 Date: Wed, 26 Jan 2022 17:39:51 +0800 Subject: [PATCH] zap log addCaller --- common/logger/logger.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/logger/logger.go b/common/logger/logger.go index 66ecf4aaf4..0af1ea861e 100644 --- a/common/logger/logger.go +++ b/common/logger/logger.go @@ -91,7 +91,7 @@ func InitLogger(conf *Config) { } if conf == nil || conf.LumberjackConfig == nil { - zapLogger, _ = config.ZapConfig.Build(zap.AddCallerSkip(1)) + zapLogger, _ = config.ZapConfig.Build(zap.AddCaller(), zap.AddCallerSkip(1)) } else { config.LumberjackConfig = conf.LumberjackConfig zapLogger = initZapLoggerWithSyncer(config) @@ -145,7 +145,7 @@ func initZapLoggerWithSyncer(conf *Config) *zap.Logger { zap.NewAtomicLevelAt(conf.ZapConfig.Level.Level()), ) - return zap.New(core, zap.AddCallerSkip(1)) + return zap.New(core, zap.AddCaller(), zap.AddCallerSkip(1)) } // getEncoder get encoder by config, zapcore support json and console encoder