mirror of
https://github.com/esphome/esphome.git
synced 2026-09-04 03:56:04 +00:00
tweak
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user