mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
apply debug from env.
This commit is contained in:
parent
e47fa91381
commit
ce42d81eeb
@ -36,16 +36,11 @@ func init() {
|
||||
zerolog.TimeFieldFormat = ""
|
||||
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||
|
||||
if viper.GetBool("debug") {
|
||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||
}
|
||||
|
||||
console := zerolog.ConsoleWriter{Out: os.Stdout}
|
||||
|
||||
if !viper.GetBool("logs") {
|
||||
log.Logger = log.Output(console)
|
||||
} else {
|
||||
|
||||
logs := filepath.Join(".", "logs")
|
||||
if runtime.GOOS == "linux" {
|
||||
logs = "/var/log/neko"
|
||||
@ -103,9 +98,14 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
debug := viper.GetBool("debug")
|
||||
if debug {
|
||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||
}
|
||||
|
||||
file := viper.ConfigFileUsed()
|
||||
logger := log.With().
|
||||
Bool("debug", viper.GetBool("debug")).
|
||||
Bool("debug", debug).
|
||||
Str("logging", viper.GetString("logs")).
|
||||
Str("config", file).
|
||||
Logger()
|
||||
|
Loading…
Reference in New Issue
Block a user