mirror of
https://github.com/esphome/esphome.git
synced 2025-09-25 14:42:21 +01:00
remove workaround
This commit is contained in:
@@ -116,7 +116,7 @@ void Logger::log_vprintf_(int level, const char *tag, int line, const __FlashStr
|
|||||||
if (this->baud_rate_ > 0) {
|
if (this->baud_rate_ > 0) {
|
||||||
this->write_msg_(this->tx_buffer_ + msg_start);
|
this->write_msg_(this->tx_buffer_ + msg_start);
|
||||||
}
|
}
|
||||||
this->call_log_callbacks_(level, tag, this->tx_buffer_ + msg_start);
|
this->log_callback_.call(level, tag, this->tx_buffer_ + msg_start);
|
||||||
|
|
||||||
global_recursion_guard_ = false;
|
global_recursion_guard_ = false;
|
||||||
}
|
}
|
||||||
@@ -129,10 +129,6 @@ inline int Logger::level_for(const char *tag) {
|
|||||||
return this->current_level_;
|
return this->current_level_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HOT Logger::call_log_callbacks_(int level, const char *tag, const char *msg) {
|
|
||||||
this->log_callback_.call(level, tag, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger::Logger(uint32_t baud_rate, size_t tx_buffer_size) : baud_rate_(baud_rate), tx_buffer_size_(tx_buffer_size) {
|
Logger::Logger(uint32_t baud_rate, size_t tx_buffer_size) : baud_rate_(baud_rate), tx_buffer_size_(tx_buffer_size) {
|
||||||
// add 1 to buffer size for null terminator
|
// add 1 to buffer size for null terminator
|
||||||
this->tx_buffer_ = new char[this->tx_buffer_size_ + 1]; // NOLINT
|
this->tx_buffer_ = new char[this->tx_buffer_size_ + 1]; // NOLINT
|
||||||
@@ -180,7 +176,7 @@ void Logger::loop() {
|
|||||||
this->tx_buffer_size_);
|
this->tx_buffer_size_);
|
||||||
this->write_footer_to_buffer_(this->tx_buffer_, &this->tx_buffer_at_, this->tx_buffer_size_);
|
this->write_footer_to_buffer_(this->tx_buffer_, &this->tx_buffer_at_, this->tx_buffer_size_);
|
||||||
this->tx_buffer_[this->tx_buffer_at_] = '\0';
|
this->tx_buffer_[this->tx_buffer_at_] = '\0';
|
||||||
this->call_log_callbacks_(message->level, message->tag, this->tx_buffer_);
|
this->log_callback_.call(message->level, message->tag, this->tx_buffer_);
|
||||||
// At this point all the data we need from message has been transferred to the tx_buffer
|
// At this point all the data we need from message has been transferred to the tx_buffer
|
||||||
// so we can release the message to allow other tasks to use it as soon as possible.
|
// so we can release the message to allow other tasks to use it as soon as possible.
|
||||||
this->log_buffer_->release_message_main_loop(received_token);
|
this->log_buffer_->release_message_main_loop(received_token);
|
||||||
|
@@ -156,7 +156,6 @@ class Logger : public Component {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void call_log_callbacks_(int level, const char *tag, const char *msg);
|
|
||||||
void write_msg_(const char *msg);
|
void write_msg_(const char *msg);
|
||||||
|
|
||||||
// Format a log message with printf-style arguments and write it to a buffer with header, footer, and null terminator
|
// Format a log message with printf-style arguments and write it to a buffer with header, footer, and null terminator
|
||||||
@@ -191,7 +190,7 @@ class Logger : public Component {
|
|||||||
if (this->baud_rate_ > 0) {
|
if (this->baud_rate_ > 0) {
|
||||||
this->write_msg_(this->tx_buffer_); // If logging is enabled, write to console
|
this->write_msg_(this->tx_buffer_); // If logging is enabled, write to console
|
||||||
}
|
}
|
||||||
this->call_log_callbacks_(level, tag, this->tx_buffer_);
|
this->log_callback_.call(level, tag, this->tx_buffer_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the body of the log message to the buffer
|
// Write the body of the log message to the buffer
|
||||||
|
Reference in New Issue
Block a user