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:
Gary Hodgson
2024-11-14 01:02:53 +01:00
committed by GitHub
parent 92bb42d444
commit 8060a77b1f
6 changed files with 32 additions and 20 deletions

View File

@ -22,6 +22,7 @@ import (
"github.com/TwiN/gatus/v5/config/web"
"github.com/TwiN/gatus/v5/security"
"github.com/TwiN/gatus/v5/storage"
"github.com/TwiN/logr"
"gopkg.in/yaml.v3"
)
@ -54,6 +55,9 @@ type Config struct {
// Debug Whether to enable debug logs
Debug bool `yaml:"debug,omitempty"`
// LogLevel is one of DEBUG, INFO, WARN and ERROR. Defaults to INFO
LogLevel logr.Level `yaml:"log-level,omitempty"`
// Metrics Whether to expose metrics at /metrics
Metrics bool `yaml:"metrics,omitempty"`