-
Notifications
You must be signed in to change notification settings - Fork 10
Add --debug
option
#177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --debug
option
#177
Conversation
Previously, specifying enough -v options made DEBUG messages visible. Signed-off-by: John Pennycook <[email protected]>
Without --debug, both cbi.log and the terminal are restricted to displaying only info, warning and error messages. With --debug, cbi.log includes debug messages by default, but the terminal displays debug messages only with sufficient --verbose flags. Signed-off-by: John Pennycook <[email protected]>
The logging module already has support for this via the exc_info argument. Making this work requires a small change to our custom Formatter, since it's the Formatter's job to inspect exc_info and include the traceback in the string output. Signed-off-by: John Pennycook <[email protected]>
The coverage CI is failing because we still don't have a good way to automate testing of the functionality in I don't want to solve that wider issue as part of this PR, so I'd like to defer it until 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.
LGTM
One suggestion is if we're including a --debug
mode, do we want to omnibus anything that might make bug reports easier?
e.g. have it dump CBI git hash information at the top, Python version, etc.
That's a really good idea. I'll add something before merging this in. |
Signed-off-by: John Pennycook <[email protected]>
The changes in 0fd1c27 will print a message like this at the beginning of the log:
Including something like the git commit hash in the message would require a dynamic version. I figured out how to do this, but I'm going to introduce it in a separate follow-up PR to make sure that we catch all the version strings (e.g., the ones in |
Related issues
Proposed changes
-vvvvvvvv
.--debug
option to enable debug mode.log.debug()
messages only in debug mode.I'm mainly adding this for myself, because it's really inconvenient to not be able to see the traceback when developing and testing work-in-progress features.
Rather than hiding this in some sort of developer branch, though, I think there is value in exposing it to end-users (as long as it's via an explicit opt-in, as I've proposed here). If we provide a
--debug
flag to generate debug logs and a traceback, users can give us much better bug reports. This is the main reason I'm trying to sneak this in ahead of 2.0 -- I'm hoping that we'll be able to attract some new users, which will probably lead to new bug reports.