From 0872592ea21274e69d54cc653e7aca1b60c1f5df Mon Sep 17 00:00:00 2001 From: adw1n Date: Thu, 15 Jul 2021 22:04:15 +0200 Subject: [PATCH] Make default console formatter work with customized level names (#330) --- console.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/console.go b/console.go index fd0cad44..c0783824 100644 --- a/console.go +++ b/console.go @@ -333,19 +333,19 @@ func consoleDefaultFormatLevel(noColor bool) Formatter { var l string if ll, ok := i.(string); ok { switch ll { - case "trace": + case LevelTraceValue: l = colorize("TRC", colorMagenta, noColor) - case "debug": + case LevelDebugValue: l = colorize("DBG", colorYellow, noColor) - case "info": + case LevelInfoValue: l = colorize("INF", colorGreen, noColor) - case "warn": + case LevelWarnValue: l = colorize("WRN", colorRed, noColor) - case "error": + case LevelErrorValue: l = colorize(colorize("ERR", colorRed, noColor), colorBold, noColor) - case "fatal": + case LevelFatalValue: l = colorize(colorize("FTL", colorRed, noColor), colorBold, noColor) - case "panic": + case LevelPanicValue: l = colorize(colorize("PNC", colorRed, noColor), colorBold, noColor) default: l = colorize("???", colorBold, noColor)