Skip to content

Commit

Permalink
fix: init logger before parse flags
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Aug 22, 2024
1 parent 6fe6727 commit f719e96
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/commands/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ Use "{{.CommandPath}} [command] --help" for more information about a command.{{e
// NewApp is the factory method to return Trivy CLI
func NewApp() *cobra.Command {
cobra.EnableTraverseRunHooks = true // To execute persistent pre-run hooks from all parents.

// Initialize the logger for `flag` and `app` packages.
// To display logs from these packages in Trivy format.
// We will set the `debug` and `disable` format after parsing the `--debug` and `--quiet` flags.
log.InitLogger(false, false)

globalFlags := flag.NewGlobalFlagGroup()
rootCmd := NewRootCommand(globalFlags)
rootCmd.AddGroup(
Expand Down

0 comments on commit f719e96

Please sign in to comment.