Added timestamp to log output.
This commit is contained in:
@@ -43,8 +43,13 @@ void appendJsonEscaped(String &out, const char *text) {
|
||||
} // namespace
|
||||
|
||||
void Log(const String &message) {
|
||||
const String trimmed = message.substring(0, kLogLineLength - 1);
|
||||
trimmed.toCharArray(g_logLines[g_logWritePos], kLogLineLength);
|
||||
snprintf(
|
||||
g_logLines[g_logWritePos],
|
||||
kLogLineLength,
|
||||
"[%010lu] %s",
|
||||
static_cast<unsigned long>(millis()),
|
||||
message.c_str()
|
||||
);
|
||||
g_logSeq[g_logWritePos] = g_nextLogSeq++;
|
||||
g_logWritePos = (g_logWritePos + 1) % kLogCapacity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user