Add timestamps to core logs

This commit is contained in:
Firepup Sixfifty 2023-11-01 21:48:16 -05:00
parent b243fb63ab
commit a41c64e53c

10
core.py
View file

@ -3,7 +3,7 @@ from os import system
from time import sleep from time import sleep
from sys import argv as args from sys import argv as args
from threading import Thread from threading import Thread
from datetime import datetime as dt
def launch(server: str) -> None: def launch(server: str) -> None:
system(f"python3 -u ircbot.py {server}") system(f"python3 -u ircbot.py {server}")
@ -30,15 +30,15 @@ def start(server):
if __name__ == "__main__": if __name__ == "__main__":
print("[LOG][CORE] Begin initialization") print(f"[LOG][CORE][{dt.now()}] Begin initialization")
for server in servers: for server in servers:
threads[server] = start(server) threads[server] = start(server)
print("[LOG][CORE] Started all instances. Idling...") print(f"[LOG][CORE][{dt.now()}] Started all instances. Idling...")
while 1: while 1:
sleep(60) sleep(60)
print("[LOG][CORE] Running a checkup on all running instances") print(f"[LOG][CORE][{dt.now()}] Running a checkup on all running instances")
for server in threads: for server in threads:
t = threads[server] t = threads[server]
if is_dead(t): if is_dead(t):
print(f"[LOG][CORE] The thread for {server} died, restarting it...") print(f"[WARN][CORE][{dt.now()}] The thread for {server} died, restarting it...")
threads[server] = start(server) threads[server] = start(server)