From 93659502f7cbe028087bc83d5729b368653faacf Mon Sep 17 00:00:00 2001 From: jpirnay Date: Wed, 8 Apr 2026 10:57:51 +0200 Subject: [PATCH] Reintroducing wallclock --- lib/Logging/Logging.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/Logging/Logging.cpp b/lib/Logging/Logging.cpp index 8a398389..2b9a4f5a 100644 --- a/lib/Logging/Logging.cpp +++ b/lib/Logging/Logging.cpp @@ -1,6 +1,7 @@ #include "Logging.h" #include +#include #include @@ -40,10 +41,17 @@ void logPrintf(const char* level, const char* origin, const char* format, ...) { va_start(args, format); char buf[MAX_ENTRY_LEN]; char* c = buf; - // add timestamp, level and origin + // add timestamp, wall clock, level and origin { unsigned long ms = millis(); - int len = snprintf(c, sizeof(buf), "[%lu] [%s] [%s] ", ms, level, origin); + char wallClock[12]; + HalClock::formatLogTime(wallClock, sizeof(wallClock)); + int len; + if (wallClock[0] != '\0') { + len = snprintf(c, sizeof(buf), "[%lu %s] [%s] [%s] ", ms, wallClock, level, origin); + } else { + len = snprintf(c, sizeof(buf), "[%lu] [%s] [%s] ", ms, level, origin); + } // error while writing => return if (len < 0) { va_end(args);