diff options
Diffstat (limited to 'bin/analyze-log.py')
-rwxr-xr-x | bin/analyze-log.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/analyze-log.py b/bin/analyze-log.py index d639b5e..8ab77a4 100755 --- a/bin/analyze-log.py +++ b/bin/analyze-log.py @@ -13,6 +13,7 @@ import dfatool.functions as df from dfatool.model import AnalyticModel from dfatool.validation import CrossValidator from functools import reduce +import logging import json import sys import re @@ -85,6 +86,13 @@ def main(): ) args = parser.parse_args() + if args.log_level: + numeric_level = getattr(logging, args.log_level.upper(), None) + if not isinstance(numeric_level, int): + print(f"Invalid log level: {args.log_level}", file=sys.stderr) + sys.exit(1) + logging.basicConfig(level=numeric_level) + if args.filter_param: args.filter_param = list( map(lambda x: x.split("="), args.filter_param.split(",")) |