diff --git a/logger/wrapper/gorm_v2.go b/logger/wrapper/gorm_v2.go index cb94ed0..fc32617 100644 --- a/logger/wrapper/gorm_v2.go +++ b/logger/wrapper/gorm_v2.go @@ -27,8 +27,8 @@ import ( // Author : go_developer@163.com<张德满> // // Date : 9:56 下午 2021/3/1 -func NewGormV2(loggerLevel zapcore.Level, consoleOutput bool, encoder zapcore.Encoder, splitConfig *logger2.RotateLogConfig, traceIDField string) (logger.Interface, error) { - logConfList := []logger2.SetLoggerOptionFunc{logger2.WithEncoder(encoder), logger2.WithCallerSkip(3), logger2.WithCaller()} +func NewGormV2(loggerLevel zapcore.Level, consoleOutput bool, encoder zapcore.Encoder, splitConfig *logger2.RotateLogConfig, traceIDField string, skip int) (logger.Interface, error) { + logConfList := []logger2.SetLoggerOptionFunc{logger2.WithEncoder(encoder), logger2.WithCallerSkip(skip), logger2.WithCaller()} if consoleOutput { logConfList = append(logConfList, logger2.WithConsoleOutput()) } diff --git a/logger/wrapper/http_gin.go b/logger/wrapper/http_gin.go index 64df301..951f813 100644 --- a/logger/wrapper/http_gin.go +++ b/logger/wrapper/http_gin.go @@ -22,12 +22,12 @@ import ( // Author : go_developer@163.com<张德满> // // Date : 3:45 下午 2021/1/3 -func NewGinLogger(loggerLevel zapcore.Level, consoleOutput bool, encoder zapcore.Encoder, splitConfig *logger.RotateLogConfig, extractFieldList []string) (*Gin, error) { +func NewGinLogger(loggerLevel zapcore.Level, consoleOutput bool, encoder zapcore.Encoder, splitConfig *logger.RotateLogConfig, extractFieldList []string, skip int) (*Gin, error) { var ( err error l *zap.Logger ) - logConfList := []logger2.SetLoggerOptionFunc{logger2.WithEncoder(encoder), logger2.WithCaller(), logger2.WithCallerSkip(1)} + logConfList := []logger2.SetLoggerOptionFunc{logger2.WithEncoder(encoder), logger2.WithCaller(), logger2.WithCallerSkip(skip)} if consoleOutput { logConfList = append(logConfList, logger2.WithConsoleOutput()) }