Spaces:
Sleeping
Sleeping
Create logger.py
Browse files
logger.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import traceback
|
2 |
+
|
3 |
+
def debug_log(label, value=None):
|
4 |
+
print(f"[DEBUG] {label}")
|
5 |
+
if value is not None:
|
6 |
+
print(value)
|
7 |
+
|
8 |
+
def log_exception(context=""):
|
9 |
+
tb = traceback.format_exc()
|
10 |
+
print(f"[ERROR] Exception during {context}:\n{tb}")
|
11 |
+
return f"<pre>[{context} ERROR]\n{tb}</pre>"
|