From 1a1ba2387caf22ad78b27275bff10812ff11c4e4 Mon Sep 17 00:00:00 2001 From: Christoph Hartmann Date: Tue, 3 Oct 2023 16:42:28 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20fix=20logging=20for=20windows=20?= =?UTF-8?q?cli=20output=20via=20powershell=20remoteing=20(#2056)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logger/cliwriter.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/logger/cliwriter.go b/logger/cliwriter.go index 7f6a9f71c9..13bee4068b 100644 --- a/logger/cliwriter.go +++ b/logger/cliwriter.go @@ -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 @@ -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] }