main: Add --debug option to increase verbosity.
authorMatthijs Kooijman <matthijs@stdin.nl>
Thu, 10 Jun 2010 07:10:55 +0000 (09:10 +0200)
committerMatthijs Kooijman <matthijs@stdin.nl>
Thu, 10 Jun 2010 07:10:55 +0000 (09:10 +0200)
src/backupninja
src/lib/backupninja/log.py

index a77242d55a14df5b610324da43bce7dab3df59db..1c2d71c26cdce22620c60ed7c3494cec0d14c7bc 100755 (executable)
@@ -59,6 +59,11 @@ def make_option_parser():
                      , default="actions"
                      , dest="actions_dir"
                      , metavar="ACTIONS_DIR")
+    parser.add_option( "-d", "--debug"
+                     , help="Run in debug mode. This only means logging is "
+                            "more verbose."
+                     , action="store_true"
+                     , dest="debug")
     return parser
  
 def main(argv):
index d079c8887c38ee58b2c41a5148c8a1440339c36b..d9d4dfac876d943af79698b2747c096af39f6ddc 100644 (file)
@@ -32,5 +32,8 @@ def setup_logging(options):
     options are the parsed commandline options.
     """
     # We use the default options for now
-    logging.basicConfig(level=logging.INFO)
+    level = logging.INFO
+    if(options.debug):
+        level = logging.DEBUG
+    logging.basicConfig(level=level)
     log.debug("Initialized logging configuration")