ciyidogan commited on
Commit
25a6568
·
verified ·
1 Parent(s): 14b6ee2

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +7 -9
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
- 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)
 
 
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")