From c5d763914ad37351f828dacc6a1fcd0c970e5951 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 6 Jul 2020 13:21:57 +0200 Subject: analyze-timing: Add --log-level option --- bin/analyze-timing.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'bin/analyze-timing.py') diff --git a/bin/analyze-timing.py b/bin/analyze-timing.py index 9271787..6761e7b 100755 --- a/bin/analyze-timing.py +++ b/bin/analyze-timing.py @@ -75,6 +75,7 @@ Options: import getopt import json +import logging import re import sys from dfatool import plotter @@ -186,6 +187,7 @@ if __name__ == "__main__": "plot-unparam= plot-param= show-models= show-quality= " "ignored-trace-indexes= discard-outliers= function-override= " "filter-param= " + "log-level= " "cross-validate= " "corrcoef param-info " "with-safe-functions hwmodel= export-energymodel=" @@ -238,6 +240,13 @@ if __name__ == "__main__": else: opt["filter-param"] = list() + if "log-level" in opt: + numeric_level = getattr(logging, opt["log-level"].upper(), None) + if not isinstance(numeric_level, int): + print(f"Invalid log level: {loglevel}", file=sys.stderr) + sys.exit(1) + logging.basicConfig(level=numeric_level) + except getopt.GetoptError as err: print(err) sys.exit(2) -- cgit v1.2.3