Skip to content

Commit

Permalink
Make default console formatter work with customized level names (#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
adw1n authored Jul 15, 2021
1 parent da1cb97 commit 0872592
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions console.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0872592

Please sign in to comment.