This commit is contained in:
Tomasz Duda
2026-02-11 12:15:54 +01:00
parent 89cc5e91b6
commit 2abf013eb4
3 changed files with 4 additions and 3 deletions

View File

@@ -1,5 +1,8 @@
#pragma once
#include "esphome/core/helpers.h"
#include "esphome/core/log.h"
namespace esphome::logger {
// Maximum header size: 35 bytes fixed + 32 bytes tag + 16 bytes thread name = 83 bytes (45 byte safety margin)

View File

@@ -80,7 +80,6 @@ void Logger::log_vprintf_non_main_thread_(uint8_t level, const char *tag, int li
auto guard = this->make_non_main_task_guard_();
bool message_sent = false;
#ifdef USE_ESPHOME_TASK_LOG_BUFFER
// For non-main threads/tasks, queue the message for callbacks
message_sent =
this->log_buffer_->send_message_thread_safe(level, tag, static_cast<uint16_t>(line), thread_name, format, args);
@@ -89,7 +88,6 @@ void Logger::log_vprintf_non_main_thread_(uint8_t level, const char *tag, int li
// This is safe to call from any context including ISRs
this->enable_loop_soon_any_context();
}
#endif // USE_ESPHOME_TASK_LOG_BUFFER
// Emergency console logging for non-main threads when ring buffer is full or disabled
// This is a fallback mechanism to ensure critical log messages are visible

View File

@@ -43,7 +43,7 @@ bool TaskLogBuffer::borrow_message_main_loop(LogMessage *&message, uint16_t &tex
}
LogMessage *msg = static_cast<LogMessage *>(received_item);
*message = msg;
message = msg;
text_length = msg->text_length;
this->current_token_ = received_item;