Skip to content

Conversation

@ondrejbudai
Copy link
Member

2 commits meant for fixing, and improving the --verbose mode. Turns out it didn't work at all before.

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.


main: enable logrus in --verbose mode

osbuild/images still use logrus for some its logging, so let's enable it
as well until we can fully migrate over.

@ondrejbudai ondrejbudai requested a review from a team as a code owner January 28, 2026 12:35
@ondrejbudai ondrejbudai requested review from achilleas-k, bcl and lzap and removed request for a team January 28, 2026 12:35
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.
osbuild/images still use logrus for some its logging, so let's enable it
as well until we can fully migrate over.
@achilleas-k achilleas-k enabled auto-merge January 29, 2026 12:41
Copy link
Contributor

@lzap lzap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logrus dependency was pulled into images accidentally. I already cleaned it from logrus and created pkg/olog proxy that is supposed to do the job. I suggest that we do not merge this and I fix images instead.

@lzap
Copy link
Contributor

lzap commented Jan 29, 2026

osbuild/images#2162

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants