Skip to content

Commit

Permalink
Merge pull request #213 from Mixaster995/feature/log-level
Browse files Browse the repository at this point in the history
Added config option for log level
  • Loading branch information
denis-tingaikin authored Oct 11, 2021
2 parents fb3788f + 39d3822 commit 10634da
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import (
type Config struct {
registryk8s.Config
ListenOn []url.URL `default:"unix:///listen.on.socket" desc:"url to listen on." split_words:"true"`
LogLevel string `default:"INFO" desc:"Log level" split_words:"true"`
}

func main() {
Expand Down Expand Up @@ -91,6 +92,11 @@ func main() {
logrus.Fatalf("error processing config from env: %+v", err)
}

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)

// Get a X509Source
Expand Down

0 comments on commit 10634da

Please sign in to comment.