mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	Merge branch 'more_str_len_logger' into integration
This commit is contained in:
		| @@ -355,7 +355,7 @@ class Logger : public Component { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   inline void HOT write_footer_to_buffer_(char *buffer, uint16_t *buffer_at, uint16_t buffer_size) { |   inline void HOT write_footer_to_buffer_(char *buffer, uint16_t *buffer_at, uint16_t buffer_size) { | ||||||
|     static const uint16_t RESET_COLOR_LEN = strlen(ESPHOME_LOG_RESET_COLOR); |     static constexpr uint16_t RESET_COLOR_LEN = sizeof(ESPHOME_LOG_RESET_COLOR) - 1; | ||||||
|     this->write_body_to_buffer_(ESPHOME_LOG_RESET_COLOR, RESET_COLOR_LEN, buffer, buffer_at, buffer_size); |     this->write_body_to_buffer_(ESPHOME_LOG_RESET_COLOR, RESET_COLOR_LEN, buffer, buffer_at, buffer_size); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -184,7 +184,9 @@ void HOT Logger::write_msg_(const char *msg) { | |||||||
|   ) { |   ) { | ||||||
|     puts(msg); |     puts(msg); | ||||||
|   } else { |   } else { | ||||||
|     uart_write_bytes(this->uart_num_, msg, strlen(msg)); |     // Use tx_buffer_at_ if msg points to tx_buffer_, otherwise fall back to strlen | ||||||
|  |     size_t len = (msg == this->tx_buffer_) ? this->tx_buffer_at_ : strlen(msg); | ||||||
|  |     uart_write_bytes(this->uart_num_, msg, len); | ||||||
|     uart_write_bytes(this->uart_num_, "\n", 1); |     uart_write_bytes(this->uart_num_, "\n", 1); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user