logger.addHandler(stdout)
if options.verbose:
logger.verbose = True
- stdout.setLevel(logging.INFO)
else:
- stdout.setLevel(logging.ERROR)
+ if not options.debug: stdout.setLevel(logging.ERROR)
+ if options.debug: logger.setLevel(logging.DEBUG)
return logger
class UserException(Exception):
optparse.OptionParser.__init__(self, *args, **kwargs)
self.add_option("-v", "--verbose", dest="verbose", action="store_true",
default=False, help="Turns on verbose output")
+ self.add_option("--debug", dest="debug", action="store_true",
+ default=False, help="Turns on debugging output")
def parse_all(self, argv, logger):
options, numeric_args = self.parse_args(argv)
return options, numeric_args, logger and logger or makeLogger(options)