# HG changeset patch # User Brian Neal # Date 1371850386 18000 # Node ID 70673126c1582b34f0b7bcb85524be4b39f547c2 # Parent 853542100fc60e7b8d14c156209ae3ce1c0983c6 Replace --verbose with --log option. diff -r 853542100fc6 -r 70673126c158 m209/main.py --- a/m209/main.py Fri Jun 21 15:57:30 2013 -0500 +++ b/m209/main.py Fri Jun 21 16:33:06 2013 -0500 @@ -16,6 +16,7 @@ DESC = "M-209 simulator and utility program" DEFAULT_KEY_LIST = 'm209keys.cfg' +LOG_CHOICES = ['debug', 'info', 'warning', 'error', 'critical'] def encrypt(args): @@ -42,8 +43,8 @@ # create the top-level parser parser = argparse.ArgumentParser(description=DESC) - parser.add_argument('-v', '--verbose', action='store_true', - help='enable verbose output') + parser.add_argument('-l', '--log', choices=LOG_CHOICES, default='warning', + help='set log level [default: %(default)s]') subparsers = parser.add_subparsers(title='list of commands', description='type %(prog)s {command} -h for help on {command}') @@ -83,8 +84,8 @@ args = parser.parse_args(args=argv) - level = logging.DEBUG if args.verbose else logging.WARNING - logging.basicConfig(level=level, format='%(levelname)s:%(message)s') + log_level = getattr(logging, args.log.upper()) + logging.basicConfig(level=log_level, format='%(levelname)s:%(message)s') args.subcommand(args)