From 0d147e5d10cb176bfd27cf7b0d7335c645130580 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 15 Nov 2025 17:42:01 -0600 Subject: [PATCH] missed one --- esphome/components/logger/logger.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esphome/components/logger/logger.cpp b/esphome/components/logger/logger.cpp index 914559a669..2e8ed2b37b 100644 --- a/esphome/components/logger/logger.cpp +++ b/esphome/components/logger/logger.cpp @@ -138,11 +138,13 @@ void Logger::log_vprintf_(uint8_t level, const char *tag, int line, const __Flas size_t msg_length = this->tx_buffer_at_ - msg_start; // Don't subtract 1 - tx_buffer_at_ is already at the null terminator position - // Write to console and send callback starting at the msg_start + // Callbacks get message first (before console write) + this->log_callback_.call(level, tag, this->tx_buffer_ + msg_start, msg_length); + + // Write to console starting at the msg_start if (this->baud_rate_ > 0) { this->write_msg_(this->tx_buffer_ + msg_start, msg_length); } - this->log_callback_.call(level, tag, this->tx_buffer_ + msg_start, msg_length); global_recursion_guard_ = false; }