jmisak's picture
Update engine/utils.py
90f1c9c verified
raw
history blame contribute delete
403 Bytes
import os
import traceback
ERROR_LOG_PATH = "./salesiq_errors.log"
def clamp(value, low, high):
return max(low, min(high, value))
def safe_log(label, msg):
try:
with open(ERROR_LOG_PATH, "a", encoding="utf-8") as f:
f.write(f"[{label}] {msg}\n")
f.write(traceback.format_exc() + "\n")
except Exception as log_err:
print("Logging failed:", log_err)