summaryrefslogtreecommitdiff
path: root/bin/analyze-archive.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2020-07-02 09:29:01 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2020-07-02 09:29:01 +0200
commitfeafeb9f619d426201b98d05e4feb77c8b1cf4a3 (patch)
treec7901ad41847cb9e2c8ced1372128e26b6686058 /bin/analyze-archive.py
parent2833115dff3da0e9b9a84fc5642b3a43034b27af (diff)
Use logging module for debug output
Diffstat (limited to 'bin/analyze-archive.py')
-rwxr-xr-xbin/analyze-archive.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/analyze-archive.py b/bin/analyze-archive.py
index 212fd2e..bf3ab64 100755
--- a/bin/analyze-archive.py
+++ b/bin/analyze-archive.py
@@ -108,6 +108,7 @@ Options:
import getopt
import json
+import logging
import random
import re
import sys
@@ -307,6 +308,7 @@ if __name__ == "__main__":
"ignored-trace-indexes= discard-outliers= function-override= "
"export-traces= "
"filter-param= "
+ "log-level= "
"cross-validate= "
"with-safe-functions hwmodel= export-energymodel="
)
@@ -354,6 +356,13 @@ if __name__ == "__main__":
if "hwmodel" in opt:
pta = PTA.from_file(opt["hwmodel"])
+ 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, file=sys.stderr)
sys.exit(2)