Commit 056ffa4
committed
main: fix --verbose logging
rootCmd.PersistentFlags().GetBool("verbose") always returned false prior
this commit because flags are not parse yet. This happens only when
rootCmd.Execute() is called.
Fix this by using one of the cobra hooks that runs after flags are
parsed. Note that the hook is needed because we want to enable verbose
logging for all subcommands. Otherwise, we would have to enable it in
every single subcommand.
I also added a small log message that actually informs users that
verbose logging is enabled.1 parent 13a177b commit 056ffa4
1 file changed
Lines changed: 13 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
646 | 646 | | |
647 | 647 | | |
648 | 648 | | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
657 | 662 | | |
658 | 663 | | |
659 | 664 | | |
| |||
0 commit comments