ciyidogan commited on
Commit
70a57a1
·
verified ·
1 Parent(s): 094b2a3

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +8 -3
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
- print(f"[{timestamp}] {message}")
8
- sys.stdout.flush()
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)