[MM-18150] plugin panic trace should not be lost (#13559)

* Transit panic from debug to error

* Parse plugin's StdErr and output panic to the mlog.Error

* Add unit tests

* Change log test

* Remove buffer from logger

* Remove 'panic' string filter

* Change *Buffer to io.Writer

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Shota Gvinepadze
2020-03-11 11:41:11 +04:00
коммит произвёл GitHub
родитель 771574b652
Коммит 5d928b4f94
6 изменённых файлов: 76 добавлений и 6 удалений

Просмотреть файл

@@ -144,6 +144,15 @@ func (l *Logger) StdLogWriter() io.Writer {
return &loggerWriter{f}
}
// StdErrPanicLogWriter returns a writer that can be hooked up to the output of a golang standard logger
// all of the stderr will be interpreted as log entry.
func (l *Logger) StdErrPanicLogWriter() io.Writer {
newLogger := *l
newLogger.zap = newLogger.zap.WithOptions(zap.AddCallerSkip(4), getStdLogOption())
f := newLogger.Error
return &panicLoggerWriter{f}
}
func (l *Logger) WithCallerSkip(skip int) *Logger {
newlogger := *l
newlogger.zap = newlogger.zap.WithOptions(zap.AddCallerSkip(skip))