mirror of https://github.com/velour/catbase.git
main: change logger
This commit is contained in:
parent
e1250dd25e
commit
f2a6d779d3
7
main.go
7
main.go
|
@ -4,6 +4,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
"io"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
@ -77,10 +78,12 @@ func main() {
|
||||||
"Database file to load. (Defaults to catbase.db)")
|
"Database file to load. (Defaults to catbase.db)")
|
||||||
flag.Parse() // parses the logging flags.
|
flag.Parse() // parses the logging flags.
|
||||||
|
|
||||||
log.Logger = log.With().Caller().Stack().Logger()
|
var output io.Writer = os.Stdout
|
||||||
if *prettyLog {
|
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)
|
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||||
if *debug {
|
if *debug {
|
||||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||||
|
|
Loading…
Reference in New Issue