summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-07-06 13:21:57 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2020-07-06 13:21:57 +0200
commitc5d763914ad37351f828dacc6a1fcd0c970e5951 (patch)
tree8a57c88c2e1b0a5976915fab50825b303c98f170
parent21e29a8e9b92d34cfcc241188b5e4b903dd9c4df (diff)
analyze-timing: Add --log-level option
-rwxr-xr-xbin/analyze-timing.py9
1 files changed, 9 insertions, 0 deletions
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)