mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +00:00 
			
		
		
		
	Merge branch 'logger_strlen' into integration
This commit is contained in:
		| @@ -90,6 +90,25 @@ void HOT Logger::log_vprintf_(uint8_t level, const char *tag, int line, const ch | |||||||
| #ifdef USE_STORE_LOG_STR_IN_FLASH | #ifdef USE_STORE_LOG_STR_IN_FLASH | ||||||
| // Implementation for ESP8266 with flash string support. | // Implementation for ESP8266 with flash string support. | ||||||
| // Note: USE_STORE_LOG_STR_IN_FLASH is only defined for ESP8266. | // Note: USE_STORE_LOG_STR_IN_FLASH is only defined for ESP8266. | ||||||
|  | // | ||||||
|  | // This function handles format strings stored in flash memory (PROGMEM) to save RAM. | ||||||
|  | // The buffer is used in a special way to avoid allocating extra memory: | ||||||
|  | // | ||||||
|  | // Memory layout during execution: | ||||||
|  | // Step 1: Copy format string from flash to buffer | ||||||
|  | //         tx_buffer_: [format_string][null][.....................] | ||||||
|  | //         tx_buffer_at_: ------------------^ | ||||||
|  | //         msg_start: saved here -----------^ | ||||||
|  | // | ||||||
|  | // Step 2: format_log_to_buffer_with_terminator_ reads format string from beginning | ||||||
|  | //         and writes formatted output starting at msg_start position | ||||||
|  | //         tx_buffer_: [format_string][null][formatted_message][null] | ||||||
|  | //         tx_buffer_at_: -------------------------------------^ | ||||||
|  | // | ||||||
|  | // Step 3: Output the formatted message (starting at msg_start) | ||||||
|  | //         write_msg_ and callbacks receive: this->tx_buffer_ + msg_start | ||||||
|  | //         which points to: [formatted_message][null] | ||||||
|  | // | ||||||
| void Logger::log_vprintf_(uint8_t level, const char *tag, int line, const __FlashStringHelper *format, | void Logger::log_vprintf_(uint8_t level, const char *tag, int line, const __FlashStringHelper *format, | ||||||
|                           va_list args) {  // NOLINT |                           va_list args) {  // NOLINT | ||||||
|   if (level > this->level_for(tag) || global_recursion_guard_) |   if (level > this->level_for(tag) || global_recursion_guard_) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user