woodpecker-autoscaler/internal/logging/logging.go
Tobias Trabelsi 9a5b9d1b55
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
ci/woodpecker/pr/woodpecker Pipeline failed
akeleton config and launch template
2023-10-29 22:44:39 +01:00

29 lines
571 B
Go

package logging
import (
"os"
"git.uploadfilter24.eu/covidnetes/woodpecker-autoscaler/internal/config"
log "github.com/sirupsen/logrus"
)
func ConfigureLogger(cfg *config.Config) {
switch cfg.LogLevel {
case "Debug":
log.SetLevel(log.DebugLevel)
case "Info":
log.SetLevel(log.InfoLevel)
case "Warn":
log.SetLevel(log.WarnLevel)
case "Error":
log.SetLevel(log.ErrorLevel)
default:
log.SetLevel(log.InfoLevel)
log.Warnf("Home: invalid log level supplied: '%s'", cfg.LogLevel)
}
log.SetFormatter(&log.JSONFormatter{})
log.SetOutput(os.Stdout)
}