From d26c9e5d59ab62a9bd2977daec2fd613ff0e35cd Mon Sep 17 00:00:00 2001 From: Chris Berkhout Date: Tue, 1 Jun 2021 19:17:42 +0200 Subject: [PATCH] Show INFO messages by default and have one option for more: --verbose. --- src/pricehist/cli.py | 14 +++----------- src/pricehist/logger.py | 6 +----- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/pricehist/cli.py b/src/pricehist/cli.py index 2f1ce5d..57ec0a3 100644 --- a/src/pricehist/cli.py +++ b/src/pricehist/cli.py @@ -18,10 +18,8 @@ def cli(args=None, output_file=sys.stdout): parser = build_parser() args = parser.parse_args() - if args.debug: + if args.verbose: logger.show_debug() - elif args.verbose: - logger.show_info() logging.debug(f"Began pricehist run at {start_time}.") @@ -118,16 +116,10 @@ def build_parser(): help="show version information", ) - logging_group = parser.add_mutually_exclusive_group(required=False) - logging_group.add_argument( + parser.add_argument( "--verbose", action="store_true", - help="show INFO messages", - ) - logging_group.add_argument( - "--debug", - action="store_true", - help="show INFO and DEBUG messages", + help="show all log messages", ) subparsers = parser.add_subparsers(title="commands", dest="command") diff --git a/src/pricehist/logger.py b/src/pricehist/logger.py index 1045d74..648598f 100644 --- a/src/pricehist/logger.py +++ b/src/pricehist/logger.py @@ -15,12 +15,8 @@ def init(): handler = logging.StreamHandler(sys.stderr) handler.setFormatter(Formatter()) logging.root.addHandler(handler) - logging.root.setLevel(logging.WARNING) + logging.root.setLevel(logging.INFO) def show_debug(): logging.root.setLevel(logging.DEBUG) - - -def show_info(): - logging.root.setLevel(logging.INFO)