Flush logs, so they actually work

This commit is contained in:
Firepup Sixfifty 2024-07-31 20:15:39 +00:00
parent d84aab7feb
commit a6ecd9a129
Signed by: Firepup650
SSH key fingerprint: SHA256:U0Zp8EhEe3CMqFSrC79CqatzaEiL4sjta80/RSX2XrY

View file

@ -30,6 +30,7 @@ def log(
print( print(
f"[{level}]{'['+origin+']' if origin else ''}[{time}] {message}", f"[{level}]{'['+origin+']' if origin else ''}[{time}] {message}",
file=stream, file=stream,
flush=True,
) )
else: else:
for line in message.split("\n"): for line in message.split("\n"):
@ -39,5 +40,6 @@ def log(
print( print(
f"[{level}]{'['+origin+']' if origin else ''}[{time}] {line}", f"[{level}]{'['+origin+']' if origin else ''}[{time}] {line}",
file=stream, file=stream,
flush=True,
) )
return (log[5:] + "\r\n").encode("utf8") return (log[5:] + "\r\n").encode("utf8")