This commit is contained in:
J. Nick Koston
2026-02-04 06:23:05 +01:00
parent f27c80cbe4
commit b2cc98e083
2 changed files with 9 additions and 7 deletions
+1 -3
View File
@@ -102,9 +102,7 @@ void Logger::log_vprintf_non_main_thread_(uint8_t level, const char *tag, int li
uint16_t console_pos;
LogBuffer buf(console_buffer, console_pos, MAX_CONSOLE_LOG_MSG_SIZE);
this->format_log_to_buffer_with_terminator_(level, tag, line, format, args, buf);
// Add newline before writing to console
buf.add_newline();
this->write_msg_(buf);
this->write_to_console_(buf);
}
// RAII guard automatically resets on return
+8 -4
View File
@@ -450,12 +450,16 @@ class Logger : public Component {
#endif
}
// Helper to write log buffer to console (adds newline and writes)
inline void HOT write_to_console_(LogBuffer &buf) {
buf.add_newline();
this->write_msg_(buf);
}
// Helper to write log buffer to console if logging is enabled
inline void HOT write_log_buffer_to_console_(LogBuffer &buf) {
if (this->baud_rate_ > 0) {
buf.add_newline();
this->write_msg_(buf);
}
if (this->baud_rate_ > 0)
this->write_to_console_(buf);
}
// Helper to format and send a log message to both console and listeners