Add --debug option to bin/hooke and log CommandEngine.run_command()
[hooke.git] / hooke / hooke.py
index a8079a9a2e498ca19b0db75730ab4cd8bc202252..b16a800c738005b2e3ecc50079430f914daad8da 100644 (file)
@@ -196,6 +196,9 @@ def main():
         '--command-no-exit', dest='command_exit',
         action='store_false', default=True,
         help="Don't exit after running a script or commands.")
+    p.add_option(
+        '--debug', dest='debug', action='store_true', default=False,
+        help="Enable debug logging.")
     options,arguments = p.parse_args()
     if len(arguments) > 0:
         print >> sys.stderr, 'More than 0 arguments to %s: %s' \
@@ -209,6 +212,10 @@ def main():
     if options.version == True:
         print version()
         sys.exit(0)
+    if options.debug == True:
+        hooke.config.set(
+            section='handler_hand1', option='level', value='NOTSET')
+        hooke.load_log()
     if options.script != None:
         with open(os.path.expanduser(options.script), 'r') as f:
             options.commands.extend(f.readlines())