feat(logging): Allow configuring logging verbosity level (#872)
* introduces TwiN/logr library * use new features of logr library * minor tweaks and formatting * Apply suggestions from code review --------- Co-authored-by: TwiN <twin@linux.com>
This commit is contained in:
7
main.go
7
main.go
@ -12,6 +12,7 @@ import (
|
||||
"github.com/TwiN/gatus/v5/controller"
|
||||
"github.com/TwiN/gatus/v5/storage/store"
|
||||
"github.com/TwiN/gatus/v5/watchdog"
|
||||
"github.com/TwiN/logr"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -23,6 +24,7 @@ func main() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
configureLogging(cfg)
|
||||
initializeStorage(cfg)
|
||||
start(cfg)
|
||||
// Wait for termination signal
|
||||
@ -57,6 +59,11 @@ func save() {
|
||||
}
|
||||
}
|
||||
|
||||
func configureLogging(cfg *config.Config) {
|
||||
logr.SetThreshold(cfg.LogLevel)
|
||||
logr.Infof("[main.configureLogging] Log Level is %s", logr.GetThreshold())
|
||||
}
|
||||
|
||||
func loadConfiguration() (*config.Config, error) {
|
||||
configPath := os.Getenv("GATUS_CONFIG_PATH")
|
||||
// Backwards compatibility
|
||||
|
Reference in New Issue
Block a user