Make default console formatter work with customized level names (#330)

This commit is contained in:
adw1n 2021-07-15 22:04:15 +02:00 committed by GitHub
parent da1cb97713
commit 0872592ea2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -333,19 +333,19 @@ func consoleDefaultFormatLevel(noColor bool) Formatter {
var l string var l string
if ll, ok := i.(string); ok { if ll, ok := i.(string); ok {
switch ll { switch ll {
case "trace": case LevelTraceValue:
l = colorize("TRC", colorMagenta, noColor) l = colorize("TRC", colorMagenta, noColor)
case "debug": case LevelDebugValue:
l = colorize("DBG", colorYellow, noColor) l = colorize("DBG", colorYellow, noColor)
case "info": case LevelInfoValue:
l = colorize("INF", colorGreen, noColor) l = colorize("INF", colorGreen, noColor)
case "warn": case LevelWarnValue:
l = colorize("WRN", colorRed, noColor) l = colorize("WRN", colorRed, noColor)
case "error": case LevelErrorValue:
l = colorize(colorize("ERR", colorRed, noColor), colorBold, noColor) l = colorize(colorize("ERR", colorRed, noColor), colorBold, noColor)
case "fatal": case LevelFatalValue:
l = colorize(colorize("FTL", colorRed, noColor), colorBold, noColor) l = colorize(colorize("FTL", colorRed, noColor), colorBold, noColor)
case "panic": case LevelPanicValue:
l = colorize(colorize("PNC", colorRed, noColor), colorBold, noColor) l = colorize(colorize("PNC", colorRed, noColor), colorBold, noColor)
default: default:
l = colorize("???", colorBold, noColor) l = colorize("???", colorBold, noColor)