[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>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
771574b652
Коммит
5d928b4f94
@@ -4,6 +4,7 @@
|
||||
package mlog
|
||||
|
||||
import (
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -23,9 +24,10 @@ func (tw *testingWriter) Write(b []byte) (int, error) {
|
||||
|
||||
// NewTestingLogger creates a Logger that proxies logs through a testing interface.
|
||||
// This allows tests that spin up App instances to avoid spewing logs unless the test fails or -verbose is specified.
|
||||
func NewTestingLogger(tb testing.TB) *Logger {
|
||||
func NewTestingLogger(tb testing.TB, writer io.Writer) *Logger {
|
||||
logWriter := &testingWriter{tb}
|
||||
logWriterSync := zapcore.AddSync(logWriter)
|
||||
multiWriter := io.MultiWriter(logWriter, writer)
|
||||
logWriterSync := zapcore.AddSync(multiWriter)
|
||||
|
||||
testingLogger := &Logger{
|
||||
consoleLevel: zap.NewAtomicLevelAt(getZapLevel("debug")),
|
||||
|
||||
Ссылка в новой задаче
Block a user