humble-bot/log/logger.go

27 lines
511 B
Go

/*
* Copyright (c) 2023 Laura Kalb <dev@lauka.net>
* The code of this project is available under the MIT license. See the LICENSE file for more info.
*
*/
package log
import (
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"os"
"time"
)
var FlagDebug bool
func InitializeLogger() {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stdout, TimeFormat: time.RFC3339})
if FlagDebug {
zerolog.SetGlobalLevel(zerolog.DebugLevel)
} else {
zerolog.SetGlobalLevel(zerolog.InfoLevel)
}
}