fix(contrib): add logrus fatal level (#2222)

pull/2234/head
wangcong 2 years ago committed by GitHub
parent de0e4e2228
commit 82dfb955f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      contrib/log/logrus/logrus.go
  2. 7
      contrib/log/logrus/logrus_test.go

@ -33,6 +33,8 @@ func (l *Logger) Log(level log.Level, keyvals ...interface{}) (err error) {
logrusLevel = logrus.WarnLevel
case log.LevelError:
logrusLevel = logrus.ErrorLevel
case log.LevelFatal:
logrusLevel = logrus.FatalLevel
default:
logrusLevel = logrus.DebugLevel
}

@ -32,6 +32,13 @@ func TestLoggerLog(t *testing.T) {
kvs: []interface{}{"case", "level unmatch", "msg", "1"},
want: "",
},
"fatal level": {
level: logrus.InfoLevel,
formatter: &logrus.JSONFormatter{},
logLevel: log.LevelFatal,
kvs: []interface{}{"case", "json format", "msg", "1"},
want: `{"case":"json format","level":"fatal","msg":"1"`,
},
"no tags": {
level: logrus.InfoLevel,
formatter: &logrus.JSONFormatter{},

Loading…
Cancel
Save