From 766f16d113bcdd2a659e14154778943126e30485 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 30 Jun 2023 13:33:57 +0300 Subject: [PATCH] Remove weird logger --- libgm/debug/logger.go | 44 ------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 libgm/debug/logger.go diff --git a/libgm/debug/logger.go b/libgm/debug/logger.go deleted file mode 100644 index aa15627..0000000 --- a/libgm/debug/logger.go +++ /dev/null @@ -1,44 +0,0 @@ -package debug - -import ( - "fmt" - "time" - - "github.com/mattn/go-colorable" - zerolog "github.com/rs/zerolog" -) - -var colors = map[string]string{ - "text": "\x1b[38;5;6m%s\x1b[0m", - "debug": "\x1b[32mDEBUG\x1b[0m", - "gray": "\x1b[38;5;8m%s\x1b[0m", - "info": "\x1b[38;5;111mINFO\x1b[0m", - "error": "\x1b[38;5;204mERROR\x1b[0m", - "fatal": "\x1b[38;5;52mFATAL\x1b[0m", -} - -var output = zerolog.ConsoleWriter{ - Out: colorable.NewColorableStdout(), - TimeFormat: time.ANSIC, - FormatLevel: func(i interface{}) string { - name := fmt.Sprintf("%s", i) - coloredName := colors[name] - return coloredName - }, - FormatMessage: func(i interface{}) string { - coloredMsg := fmt.Sprintf(colors["text"], i) - return coloredMsg - }, - FormatFieldName: func(i interface{}) string { - name := fmt.Sprintf("%s", i) - return fmt.Sprintf(colors["gray"], name+"=") - }, - FormatFieldValue: func(i interface{}) string { - return fmt.Sprintf("%s", i) - }, - NoColor: false, -} - -func NewLogger() zerolog.Logger { - return zerolog.New(output).With().Timestamp().Logger() -}