Skip to content

Commit

Permalink
added config option for log level (#382)
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 d9c0b2c commit 4893f70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ type Config struct {
ListenOn []url.URL `default:"unix:///var/lib/networkservicemesh/nsm.io.sock" desc:"url to listen on. tcp:// one will be used a public to register NSM." split_words:"true"`
RegistryURL url.URL `default:"tcp://localhost:5001" desc:"A NSE registry url to use" split_words:"true"`
MaxTokenLifetime time.Duration `default:"10m" desc:"maximum lifetime of tokens" split_words:"true"`
LogLevel string `default:"INFO" desc:"Log level" split_words:"true"`
}
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,16 @@ func main() {

logrus.Infof("Using configuration: %v", cfg)

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

// Startup is finished
finish()

err := manager.RunNsmgr(traceCtx, cfg)
err = manager.RunNsmgr(traceCtx, cfg)
if err != nil {
logrus.Fatalf("error executing rootCmd: %v", err)
}
Expand Down

0 comments on commit 4893f70

Please sign in to comment.