more logging lol MP1 init

This commit is contained in:
Aryan Singh committed 2026-09-27 23:03:17 -05:00
1 parent 9d92ec45e8
commit 5b9a1414a2
1 file changed
+6
+6
View File
@@ -15,13 +15,19 @@ def _machine_index():
return None
log_file = open(f"machine.{_machine_index()}.log", "w")
log_file_mp1 = open(f"/home/asing271/fa26_cs425_.group-mp_.team-01/MP1/machine.{_machine_index()}.log","w")
log_lock = threading.Lock()
def log(message):
timestamp = datetime.now().strftime("%H:%M:%S.%f")[:-3]
with log_lock:
print(f"[{timestamp}] {message}")
log_file.write(f"[{timestamp}] {message}\n")
log_file.flush()
log_file_mp1.write(f"[{timestamp}] {message}\n")
log_file_mp1.flush()
def utc_time():
return datetime.now(timezone.utc).timestamp()