Spaces:
Running
Running
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -4,9 +4,14 @@ from datetime import datetime
|
|
| 4 |
|
| 5 |
def log(message):
|
| 6 |
timestamp = datetime.now().strftime("%H:%M:%S")
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
def save_service_config(config):
|
| 11 |
with open("service_config.json", "w") as f:
|
| 12 |
json.dump(config.data, f, indent=2)
|
|
|
|
| 4 |
|
| 5 |
def log(message):
|
| 6 |
timestamp = datetime.now().strftime("%H:%M:%S")
|
| 7 |
+
line = f"[{timestamp}] {message}"
|
| 8 |
+
print(line, flush=True)
|
| 9 |
+
try:
|
| 10 |
+
with open("/tmp/logs.txt", "a", encoding="utf-8") as f:
|
| 11 |
+
f.write(line + "\n")
|
| 12 |
+
except Exception:
|
| 13 |
+
pass # dosya erişim hataları sessizce geçilir
|
| 14 |
+
|
| 15 |
def save_service_config(config):
|
| 16 |
with open("service_config.json", "w") as f:
|
| 17 |
json.dump(config.data, f, indent=2)
|