Skip to content

Commit

Permalink
Added config option for log level (#289)
Browse files Browse the repository at this point in the history
Signed-off-by: Mikhail Avramenko <avramenkomihail15@gmail.com>
  • Loading branch information
Mixaster995 authored Oct 9, 2021
1 parent 3ec1a4d commit 0a61f0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Config struct {
Mechanism string `default:"kernel" desc:"Default Mechanism to use, supported values: kernel, vfio" split_words:"true"`

NetworkServices []url.URL `default:"" desc:"A list of Network Service Requests" split_words:"true"`
LogLevel string `default:"INFO" desc:"Log level" split_words:"true"`
}

// IsValid - check if configuration is valid
Expand Down
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ func main() {
logger.Fatalf("error processing rootConf from env: %+v", err)
}

level, err := logrus.ParseLevel(c.LogLevel)
if err != nil {
logrus.Fatalf("invalid log level %s", c.LogLevel)
}
logrus.SetLevel(level)

logger.Infof("rootConf: %+v", c)

// ********************************************************************************
Expand Down

0 comments on commit 0a61f0c

Please sign in to comment.