Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you not just log this after you've set up the
stdout
handler?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. This is a tricky one, I think.
Written this way, the message is part of CBI's output. It's always printed to the terminal, regardless of how many
-q
or-v
flags the user passed. It's (hopefully) very difficult for a user to miss this message, but it won't be logged.If we wrote this to the log using
log.info
, it wouldn't show up tostdout
by default. A user would have to run with-vv
to see it, and that would also turn on all the warnings and other information messages, too.One possible, but slightly hacky, solution would be to write it like this:
Logging before we call
setLevel
means the message displays unconditionally, but also gets written to the log. There's probably a smarter way to set up different logging rules for__main__.py
, but that might be overkill if we only care about this one message.Is that too much of a hack, or do you think it's okay?