Pass cli args to logging configure, will be used soon, and use < INFO instead of <= DEBUG

This commit is contained in:
Joshua Harlow 2012-03-30 10:42:00 -07:00
parent fa00c7cbbd
commit 51522bd5ac
2 changed files with 4 additions and 3 deletions

View File

@ -83,7 +83,7 @@ def construct_log_level(verbosity_level, dry_run=False):
return log_level
def configure_logging(log_level):
def configure_logging(log_level, cli_args):
root_logger = logging.getLogger().logger
console_logger = logging.StreamHandler(sys.stdout)
console_format = '%(levelname)s: @%(name)s : %(message)s'

5
stack
View File

@ -180,7 +180,7 @@ def main():
# Configure logging
log_level = utils.construct_log_level(args['verbosity'], args['dryrun'])
utils.configure_logging(log_level)
utils.configure_logging(log_level, args)
LOG.debug("Command line options %s" % (args))
LOG.debug("Log level is: %s" % (log_level))
@ -209,8 +209,9 @@ def main():
except Exception:
utils.goodbye(False)
traceback = None
if log_level <= logging.DEBUG:
if log_level < logging.INFO:
# See: http://docs.python.org/library/traceback.html
# When its not none u get more detailed info about the exception
traceback = sys.exc_traceback
tb.print_exception(sys.exc_type, sys.exc_value,
traceback, file=sys.stdout)