Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Only show exception tracebacks when in higher verbosity mode

  • Loading branch information...
commit c1b39af1efe56aca8b1c6ed06162017f9a049802 1 parent 1dc16e4
Joshua Harlow harlowja authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 stack
12 stack
View
@@ -18,7 +18,7 @@
import sys
import time
-import traceback
+import traceback as tb
from devstack import cfg
from devstack import cfg_helpers
@@ -179,7 +179,8 @@ def main():
prog_name = sys.argv[0]
# Configure logging
- utils.configure_logging(args['verbosity'], args['dryrun'])
+ verbosity = args['verbosity']
+ utils.configure_logging(verbosity, args['dryrun'])
LOG.debug("Command line options %s" % (args))
@@ -206,7 +207,12 @@ def main():
return 0
except Exception:
utils.goodbye(False)
- traceback.print_exc(file=sys.stdout)
+ traceback = None
+ if verbosity >= 3:
+ # See: http://docs.python.org/library/traceback.html
+ traceback = sys.exc_traceback
+ tb.print_exception(sys.exc_type, sys.exc_value,
+ traceback, file=sys.stdout)
return 1
Please sign in to comment.
Something went wrong with that request. Please try again.