forked from Firepup650/python-talk
Flush logs, so they actually work
This commit is contained in:
parent
d84aab7feb
commit
a6ecd9a129
1 changed files with 2 additions and 0 deletions
2
logs.py
2
logs.py
|
@ -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")
|
||||||
|
|
Loading…
Reference in a new issue