diff --git a/.golangci.yml b/.golangci.yml index 7c00ea2..7f824b1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -36,7 +36,7 @@ linters-settings: threshold: 150 funlen: Lines: 180 - Statements: 75 + Statements: 80 goconst: min-len: 2 min-occurrences: 2 diff --git a/main.go b/main.go index e6bcf35..a50fb41 100644 --- a/main.go +++ b/main.go @@ -73,6 +73,7 @@ type Config struct { Labels map[string]string `default:"" desc:"Endpoint labels"` CidrPrefix string `default:"169.254.0.0/16" desc:"CIDR Prefix to assign IPs from" split_words:"true"` RegisterService bool `default:"true" desc:"if true then registers network service on startup" split_words:"true"` + LogLevel string `default:"INFO" desc:"Log level" split_words:"true"` } // Process prints and processes env to config @@ -131,6 +132,12 @@ func main() { logrus.Fatal(err.Error()) } + l, err := logrus.ParseLevel(config.LogLevel) + if err != nil { + logrus.Fatalf("invalid log level %s", config.LogLevel) + } + logrus.SetLevel(l) + log.FromContext(ctx).Infof("Config: %#v", config) // ********************************************************************************