From d2d2a9c617b662a38b87652c4996804d5c17b23c Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 21 Dec 2023 13:12:43 -0500 Subject: [PATCH] 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. --- daemon-common/log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon-common/log.py b/daemon-common/log.py index 2fc69956..cf1009d3 100644 --- a/daemon-common/log.py +++ b/daemon-common/log.py @@ -146,7 +146,7 @@ class Logger(object): if self.config["stdout_logging"]: # Assemble output string output = colour + prompt + endc + date + prefix + message - print(output) + print(output + "\n", end="") # Log to file if self.config["file_logging"]: