From 8dcf50534ea13fa398cbcf2b3660c356ca3a557e Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Tue, 24 Sep 2013 10:30:10 +0300 Subject: [PATCH] bmaptool: introduce --debug option We often need to print debugging information, let's add a --debug option for this. Change-Id: I038e2163d2d5929b4bd07416547936fc34bf09c2 Signed-off-by: Artem Bityutskiy --- bmaptool | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bmaptool b/bmaptool index d375781..06d57c8 100755 --- 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: -- 2.7.4