Added timestamp to log output.
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user