bmaptool: introduce --debug option
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Tue, 24 Sep 2013 07:30:10 +0000 (10:30 +0300)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Mon, 30 Sep 2013 07:10:03 +0000 (10:10 +0300)
We often need to print debugging information, let's add a --debug option for
this.

Change-Id: I038e2163d2d5929b4bd07416547936fc34bf09c2
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
bmaptool

index d3757813eb0c69af0915c9c895260c53b34a78e5..06d57c845fc19ea2590aa931d27161cf960f2e2e 100755 (executable)
--- a/bmaptool
+++ b/bmaptool
@@ -567,6 +567,10 @@ def parse_arguments():
     text = "be quiet"
     parser.add_argument("-q", "--quiet", action = "store_true", help = text)
 
+    # The --debug option
+    text = "print debugging information"
+    parser.add_argument("-d", "--debug", action = "store_true", help = text)
+
     subparsers = parser.add_subparsers(title = "subcommands")
 
     #
@@ -660,11 +664,17 @@ def main():
 
     if args.quiet:
         loglevel = logging.WARNING
+    elif args.debug:
+        loglevel = logging.DEBUG
     else:
         loglevel = logging.INFO
 
     log = setup_logger(loglevel)
 
+    if args.quiet and args.debug:
+        log.error("--quiet and --debug cannot be used together")
+        raise SystemExit(1)
+
     try:
         args.func(args, log)
     except MemoryError: