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