From ca0d078c4f4509f5da2d5f5182f99dbd1c0c72ce Mon Sep 17 00:00:00 2001 From: adw1n Date: Thu, 15 Jul 2021 13:30:45 +0200 Subject: [PATCH] Make default console formatter work with customized level names --- 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)