diff options
author | JoramWilander <jwawilander@gmail.com> | 2018-07-10 15:01:43 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2018-07-10 15:01:43 -0400 |
commit | 6c7dc2d29ccac5f9925402f6be1a4c2a3c46c005 (patch) | |
tree | 5564a47257bf6e85aaef711980c5b0fcb4d07dcc /mlog/global.go | |
parent | c042ffa460296587579aff54b157a5109e022f7e (diff) | |
parent | 1e1a5e5e85240f25c4faddcb24c5a29a915fe6e4 (diff) | |
download | chat-6c7dc2d29ccac5f9925402f6be1a4c2a3c46c005.tar.gz chat-6c7dc2d29ccac5f9925402f6be1a4c2a3c46c005.tar.bz2 chat-6c7dc2d29ccac5f9925402f6be1a4c2a3c46c005.zip |
Merge branch 'plugins-2'
Diffstat (limited to 'mlog/global.go')
-rw-r--r-- | mlog/global.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mlog/global.go b/mlog/global.go index 36dd51afb..ba90ace2f 100644 --- a/mlog/global.go +++ b/mlog/global.go @@ -11,7 +11,9 @@ import ( var globalLogger *Logger func InitGlobalLogger(logger *Logger) { - globalLogger = logger + glob := *logger + glob.zap = glob.zap.WithOptions(zap.AddCallerSkip(1)) + globalLogger = &glob Debug = globalLogger.Debug Info = globalLogger.Info Warn = globalLogger.Warn @@ -20,7 +22,7 @@ func InitGlobalLogger(logger *Logger) { } func RedirectStdLog(logger *Logger) { - zap.RedirectStdLogAt(logger.zap.With(zap.String("source", "stdlog")), zapcore.ErrorLevel) + zap.RedirectStdLogAt(logger.zap.With(zap.String("source", "stdlog")).WithOptions(zap.AddCallerSkip(-2)), zapcore.ErrorLevel) } type LogFunc func(string, ...Field) |