From f2a6d779d3c8a79151c015b1bb3e66f82a9c437a Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Tue, 4 May 2021 13:57:57 -0400 Subject: [PATCH] main: change logger --- main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index b22f361..fb38297 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ package main import ( "flag" + "io" "math/rand" "net/http" "os" @@ -77,10 +78,12 @@ func main() { "Database file to load. (Defaults to catbase.db)") flag.Parse() // parses the logging flags. - log.Logger = log.With().Caller().Stack().Logger() + var output io.Writer = os.Stdout if *prettyLog { - log.Logger = log.Logger.Output(zerolog.ConsoleWriter{Out: os.Stderr}) + output = zerolog.ConsoleWriter{Out: output} } + log.Logger = log.Output(output).With().Caller().Stack().Logger() + zerolog.SetGlobalLevel(zerolog.InfoLevel) if *debug { zerolog.SetGlobalLevel(zerolog.DebugLevel)