Skip to content

Commit

Permalink
register log-level flag
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Nov 8, 2023
1 parent 2a0eb3a commit 5174bc2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ func NewRootCmd(log *zap.Logger) *cobra.Command {
panic(err)
}

// Register --log-level flag
rootCmd.PersistentFlags().String("log-level", "info", "log level format (info, debug, warn, error, panic or fatal)")
if err := a.viper.BindPFlag("log-level", rootCmd.PersistentFlags().Lookup("log-level")); err != nil {
panic(err)
}

// Register subcommands
rootCmd.AddCommand(
configCmd(a),
Expand Down

0 comments on commit 5174bc2

Please sign in to comment.