diff --git a/src/log.d b/src/log.d index 049c46ff..21977c27 100644 --- a/src/log.d +++ b/src/log.d @@ -55,13 +55,13 @@ class LogBuffer { void shutdown() { synchronized(bufferLock) { + if (!isRunning) return; // Prevent multiple shutdowns isRunning = false; - condReady.notify(); + condReady.notifyAll(); // Wake up all waiting threads } - flushThread.join(); - flush(); + flushThread.join(); // Wait for the flush thread to finish + flush(); // Perform a final flush to ensure all data is processed } - shared void logThisMessage(string message, string[] levels = ["info"]) { // Generate the timestamp for this log entry auto timeStamp = leftJustify(Clock.currTime().toString(), 28, '0');