File size: 403 Bytes
a0ef77d
90f1c9c
a0ef77d
 
 
 
 
 
 
 
 
90f1c9c
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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)