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>
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")
#
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: