]> scripts.mit.edu Git - wizard.git/blobdiff - lib/wizard/__init__.py
Add debugging.
[wizard.git] / lib / wizard / __init__.py
index 309b86c700430ec51de9904da4a84152c89a576d..f9fbb9fa6f81d6685769369e109bf55e9a3169d1 100644 (file)
@@ -9,9 +9,9 @@ def makeLogger(options):
     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):
@@ -29,6 +29,8 @@ class WizardOptionParser(optparse.OptionParser):
         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)