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
Support --debug flag to enable backtrace and debug logs. #332
Support --debug flag to enable backtrace and debug logs. #332
Conversation
@@ -95,6 +95,9 @@ def main(): | |||
try: | |||
commands.load(args['COMMAND']).main(argv=args['ARGS']) | |||
except Exception as e: | |||
if args['--verbose']: |
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.
please let's use --debug
for this.
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.
Ah, I went back and forth on that-- easy peasy.
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.
Done. Also changed log level.
695c70a
to
fd57ca5
Compare
fd57ca5
to
6cccd51
Compare
args = docopt(__doc__, version=_get_version(), options_first=True) | ||
|
||
cmd = args['COMMAND'] or 'snap' | ||
if cmd not in _VALID_COMMANDS: | ||
sys.exit('Command {!r} was not recognized'.format(cmd)) | ||
|
||
# Default log level is INFO unless --debug is specified | ||
log_level = logging.INFO | ||
if args['--debug']: |
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.
--debug
won't exist if it is not declared above in the docstring docopt uses.
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.
Oh for heaven's sake... conflict resolution fail.
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.
Fixed. Good catch!
6cccd51
to
7c52e52
Compare
@@ -26,6 +26,7 @@ | |||
-h --help show this help message and exit | |||
-v --version show program version and exit | |||
-V --verbose print additional information about command execution | |||
-d --debug print debug information while executing (backtraces, etc.) |
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.
maybe (including backtraces) and leave out etc as that can mean anything
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.
Done.
One comment and we are good 👍 also rebase with |
7c52e52
to
49b3d62
Compare
LP: #1548492 Signed-off-by: Kyle Fazzari <kyle@canonical.com>
49b3d62
to
580c43e
Compare
…race Support --debug flag to enable backtrace and debug logs.
…how_backtrace Support --debug flag to enable backtrace and debug logs.
This PR resolves LP: #1548492 by re-raising any caught exception and changing the log level to DEBUG if Snapcraft is running with the
-d
or--debug
argument.