diff --git a/zapcore/level.go b/zapcore/level.go index 751cf0b98..f3e166d67 100644 --- a/zapcore/level.go +++ b/zapcore/level.go @@ -179,19 +179,19 @@ func (l *Level) UnmarshalText(text []byte) error { func (l *Level) unmarshalText(text []byte) bool { switch string(text) { - case "debug", "DEBUG": + case "debug": *l = DebugLevel - case "info", "INFO", "": // make the zero value useful + case "info", "": // make the zero value useful *l = InfoLevel - case "warn", "warning", "WARN": + case "warn", "warning": *l = WarnLevel - case "error", "ERROR": + case "error": *l = ErrorLevel - case "dpanic", "DPANIC": + case "dpanic": *l = DPanicLevel - case "panic", "PANIC": + case "panic": *l = PanicLevel - case "fatal", "FATAL": + case "fatal": *l = FatalLevel default: return false diff --git a/zapcore/level_test.go b/zapcore/level_test.go index eaa8e0803..6e88f7781 100644 --- a/zapcore/level_test.go +++ b/zapcore/level_test.go @@ -96,6 +96,7 @@ func TestParseLevel(t *testing.T) { {"info", InfoLevel, ""}, {"DEBUG", DebugLevel, ""}, {"FOO", 0, `unrecognized level: "FOO"`}, + {"WARNING", WarnLevel, ""}, } for _, tt := range tests { parsedLevel, err := ParseLevel(tt.text)