Skip to content

Commit a080148

Browse files
authored
Merge pull request #1308 from afbjorklund/silent
Enable silent log-level for hiding INFO messages
2 parents 120b130 + 8fa03ca commit a080148

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/limactl/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,17 @@ func newApp() *cobra.Command {
5555
SilenceUsage: true,
5656
SilenceErrors: true,
5757
}
58+
rootCmd.PersistentFlags().String("log-level", "", "Set the logging level [trace, debug, info, warn, error]")
5859
rootCmd.PersistentFlags().Bool("debug", false, "debug mode")
5960
rootCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
61+
l, _ := cmd.Flags().GetString("log-level")
62+
if l != "" {
63+
lvl, err := logrus.ParseLevel(l)
64+
if err != nil {
65+
return err
66+
}
67+
logrus.SetLevel(lvl)
68+
}
6069
debug, _ := cmd.Flags().GetBool("debug")
6170
if debug {
6271
logrus.SetLevel(logrus.DebugLevel)

0 commit comments

Comments
 (0)