From e4e9c4c9e9a7b2caebc041d907545c58a00198d1 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Tue, 22 Oct 2024 13:38:39 +0200 Subject: [PATCH] feat(clustertool): add output formatting to zerolog --- clustertool/main.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/clustertool/main.go b/clustertool/main.go index f823185e135..effe7275e36 100644 --- a/clustertool/main.go +++ b/clustertool/main.go @@ -55,8 +55,14 @@ func main() { zerolog.SetGlobalLevel(zerologLevel) log.Logger = log.Output(zerolog.ConsoleWriter{ Out: os.Stdout, - TimeFormat: time.RFC3339, - NoColor: true, + TimeFormat: time.RFC3339, // Keep this for the timestamp format + NoColor: false, // Set to true if you prefer no color + FormatLevel: func(i interface{}) string { + return fmt.Sprintf("\033[1;34m[%s]\033[0m", i) // Blue color for level + }, + FormatMessage: func(i interface{}) string { + return fmt.Sprintf("\033[1;32m%s\033[0m", i) // Green color for message + }, }) // Configure zap logger