summaryrefslogtreecommitdiffstats
path: root/mlog/global.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-07-03 09:58:28 -0700
committerGitHub <noreply@github.com>2018-07-03 09:58:28 -0700
commit83a3ac089cff0d05559e6ba5c2c60b09f5cae176 (patch)
tree51cc53c0a77cf455cf9d700a453b6d57f1604fdb /mlog/global.go
parent3848cb7e79e019e2f0878d6e2377ad36b3c7ca43 (diff)
downloadchat-83a3ac089cff0d05559e6ba5c2c60b09f5cae176.tar.gz
chat-83a3ac089cff0d05559e6ba5c2c60b09f5cae176.tar.bz2
chat-83a3ac089cff0d05559e6ba5c2c60b09f5cae176.zip
MM-11029 Adding plugin logging functionality. (#9034)
* Capturing stdout, stderr of plugins in logs. * Cleanup go-plugin debug logs. * Adding logging to plugin API * Generating mocks. * godoc convention
Diffstat (limited to 'mlog/global.go')
-rw-r--r--mlog/global.go6
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)