Spaces:
Building
Building
Update utils.py
Browse files
utils.py
CHANGED
@@ -2,16 +2,14 @@ import json
|
|
2 |
import sys
|
3 |
from datetime import datetime
|
4 |
|
|
|
|
|
5 |
def log(message):
|
6 |
timestamp = datetime.now().strftime("%H:%M:%S")
|
7 |
-
|
8 |
-
|
9 |
-
|
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(
|
17 |
json.dump(config.data, f, indent=2)
|
|
|
|
2 |
import sys
|
3 |
from datetime import datetime
|
4 |
|
5 |
+
CONFIG_FILE = "service_config.json"
|
6 |
+
|
7 |
def log(message):
|
8 |
timestamp = datetime.now().strftime("%H:%M:%S")
|
9 |
+
print(f"[{timestamp}] {message}")
|
10 |
+
sys.stdout.flush()
|
11 |
+
|
|
|
|
|
|
|
|
|
|
|
12 |
def save_service_config(config):
|
13 |
+
with open(CONFIG_FILE, "w") as f:
|
14 |
json.dump(config.data, f, indent=2)
|
15 |
+
log("✅ Config saved to disk")
|