Include our newline atomically

Sometimes clashing log entries would print on the same line, likely due
to some sort of race condition in Python's print() built-in.

Instead, add a newline to our actual message and print without an end
character. This ensures atomic printing of our log messages.
This commit is contained in:
Joshua Boniface 2023-12-21 13:12:43 -05:00
parent 6ed4efad33
commit d2d2a9c617
1 changed files with 1 additions and 1 deletions

View File

@ -146,7 +146,7 @@ class Logger(object):
if self.config["stdout_logging"]: if self.config["stdout_logging"]:
# Assemble output string # Assemble output string
output = colour + prompt + endc + date + prefix + message output = colour + prompt + endc + date + prefix + message
print(output) print(output + "\n", end="")
# Log to file # Log to file
if self.config["file_logging"]: if self.config["file_logging"]: