From: Matthijs Kooijman Date: Thu, 10 Jun 2010 07:10:55 +0000 (+0200) Subject: main: Add --debug option to increase verbosity. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=5da4fb89ab2bdad92435be2b4ba38061b2834a36;p=matthijs%2Fprojects%2Fbackupninja.git main: Add --debug option to increase verbosity. --- diff --git a/src/backupninja b/src/backupninja index a77242d..1c2d71c 100755 --- a/src/backupninja +++ b/src/backupninja @@ -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): diff --git a/src/lib/backupninja/log.py b/src/lib/backupninja/log.py index d079c88..d9d4dfa 100644 --- a/src/lib/backupninja/log.py +++ b/src/lib/backupninja/log.py @@ -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")