Skip to content

Commit

Permalink
🧹 fix logging for windows cli output via powershell remoteing (#2056)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-rock authored Oct 3, 2023
1 parent 6f1fa5f commit 1a1ba23
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions logger/cliwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ func consoleDefaultFormatErrFieldValue() zerolog.Formatter {
}
}

// consoleFormatLevelNoColor returns a formatter that outputs the level in uppercase without any color
// this is used for compact mode and primarily for windows which has a restricted color palette and character set
// for the console
func consoleFormatLevelNoColor() zerolog.Formatter {
return func(i interface{}) string {
var l string
Expand All @@ -97,21 +100,21 @@ func consoleFormatLevelNoColor() zerolog.Formatter {
case "debug":
l = "DBG"
case "info":
l = ""
l = "-"
case "warn":
l = "!"
l = "WRN"
case "error":
l = "x"
l = "ERR"
case "fatal":
l = "FTL"
case "panic":
l = "PNC"
default:
l = "???"
l = "UNK"
}
} else {
if i == nil {
l = "???"
l = "UNK"
} else {
l = strings.ToUpper(fmt.Sprintf("%s", i))[0:3]
}
Expand Down

0 comments on commit 1a1ba23

Please sign in to comment.