Update engine/utils.py
Browse files- engine/utils.py +13 -2
engine/utils.py
CHANGED
|
@@ -1,2 +1,13 @@
|
|
| 1 |
-
|
| 2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
ERROR_LOG_PATH = "./salesiq_errors.log"
|
| 4 |
+
|
| 5 |
+
def clamp(value, low, high):
|
| 6 |
+
return max(low, min(high, value))
|
| 7 |
+
|
| 8 |
+
def safe_log(label, msg):
|
| 9 |
+
try:
|
| 10 |
+
with open(ERROR_LOG_PATH, "a", encoding="utf-8") as f:
|
| 11 |
+
f.write(f"[{label}] {msg}\n")
|
| 12 |
+
except Exception:
|
| 13 |
+
pass
|