about summary refs log tree commit diff stats
path: root/archive/2024/winter/bsc_dichler/scripts/log.py
diff options
context:
space:
mode:
authorMartin Fink <martin@finkmartin.com>2025-05-12 08:14:08 +0200
committerGitHub <noreply@github.com>2025-05-12 08:14:08 +0200
commit0866a557ac461a1b345dd9ff1e13b01105458ef8 (patch)
tree483f44335b623c1f2a8ba911d1feb776eb3df642 /archive/2024/winter/bsc_dichler/scripts/log.py
parente546f71869e32e88716c4ad05e0254ea3352a668 (diff)
parentf60cf8c4ba75eee2b25ffbeea2330206b257aae9 (diff)
downloadresearch-work-archive-artifacts-0866a557ac461a1b345dd9ff1e13b01105458ef8.tar.gz
research-work-archive-artifacts-0866a557ac461a1b345dd9ff1e13b01105458ef8.zip
Merge pull request #2 from raphaeldichler/main
Add source code of 'Evaluation of the Performance of the Memory Tagging Extensions'
Diffstat (limited to 'archive/2024/winter/bsc_dichler/scripts/log.py')
-rw-r--r--archive/2024/winter/bsc_dichler/scripts/log.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/archive/2024/winter/bsc_dichler/scripts/log.py b/archive/2024/winter/bsc_dichler/scripts/log.py
new file mode 100644
index 000000000..0bb7fb438
--- /dev/null
+++ b/archive/2024/winter/bsc_dichler/scripts/log.py
@@ -0,0 +1,20 @@
+def log(prefix: str, msg: str, intend: int = 0):
+    intend_offset = "\t" * intend
+    for line in msg.split("\n"):
+        if len(line) == 0:
+            continue
+        line = prefix + intend_offset + msg
+        print(line, flush=True)
+
+
+def info(msg: str, intend: int = 1):
+    intend = intend + 1
+    GREEN = "\033[32m"
+    RESET = "\033[0m\033[39m"
+    log(prefix=GREEN + "stdout>" + RESET, msg=msg, intend=intend)
+
+
+def error(msg: str):
+    RED = "\033[31m"
+    RESET = "\033[0m\033[39m"
+    log(prefix=RED + "stderr>" + RESET, msg=msg, intend=1)