Skip to content

Commit

Permalink
Added logger instantiation to CLI. Fixes #103
Browse files Browse the repository at this point in the history
  • Loading branch information
bschroeter committed Dec 20, 2023
1 parent 59e56fe commit 43deac8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions benchcab/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from benchcab.benchcab import Benchcab
from benchcab.cli import generate_parser
from benchcab.utils import get_logger


def parse_and_dispatch(parser):
Expand All @@ -16,6 +17,13 @@ def parse_and_dispatch(parser):
Parser object.
"""
args = vars(parser.parse_args(sys.argv[1:] if sys.argv[1:] else ["-h"]))

# Intercept the verbosity flag to engage the logger
log_level = 'debug' if args.get('verbose', False) == True else 'info'

Check warning on line 22 in benchcab/main.py

View check run for this annotation

Codecov / codecov/patch

benchcab/main.py#L22

Added line #L22 was not covered by tests

# We just need to instantiate this with the desired level
logger = get_logger(level=log_level)

Check warning on line 25 in benchcab/main.py

View check run for this annotation

Codecov / codecov/patch

benchcab/main.py#L25

Added line #L25 was not covered by tests

func = args.pop("func")
func(**args)

Expand Down

0 comments on commit 43deac8

Please sign in to comment.