Update log.d

* Potentially resolve 'Aborting from core/sync/mutex.d(149) Error: pthread_mutex_destroy failed.[1]    44576 IOT instruction (core dumped)' errors
This commit is contained in:
abraunegg 2024-03-22 08:23:01 +11:00
parent a6e2f778c9
commit 46dfb051fe

View file

@ -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');