Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make default console formatter work with customized level names #330

Merged
merged 1 commit into from Jul 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions console.go
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