flare / utils.py
ciyidogan's picture
Update utils.py
70a57a1 verified
raw
history blame
510 Bytes
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)