summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBirte Kristina Friesel <birte.friesel@uos.de>2023-12-22 07:07:21 +0100
committerBirte Kristina Friesel <birte.friesel@uos.de>2023-12-22 07:07:21 +0100
commitaf4d3bc3dae8a42cfd8ceaf31876d2d355369af4 (patch)
tree6fc1bb789bc28834722585d9196a8867ecddd474 /bin
parentdac3650b6d0f474aaff502d66c04936a945f28cc (diff)
analyze-log: support log-level configuration
Diffstat (limited to 'bin')
-rwxr-xr-xbin/analyze-log.py8
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(","))