Added timestamp to log output.

This commit is contained in:
2026-02-21 15:46:28 +01:00
parent 556c7888de
commit a23ca75d92

View File

@@ -43,8 +43,13 @@ void appendJsonEscaped(String &out, const char *text) {
} // namespace } // namespace
void Log(const String &message) { void Log(const String &message) {
const String trimmed = message.substring(0, kLogLineLength - 1); snprintf(
trimmed.toCharArray(g_logLines[g_logWritePos], kLogLineLength); g_logLines[g_logWritePos],
kLogLineLength,
"[%010lu] %s",
static_cast<unsigned long>(millis()),
message.c_str()
);
g_logSeq[g_logWritePos] = g_nextLogSeq++; g_logSeq[g_logWritePos] = g_nextLogSeq++;
g_logWritePos = (g_logWritePos + 1) % kLogCapacity; g_logWritePos = (g_logWritePos + 1) % kLogCapacity;
} }