mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 06:33:51 +00:00 
			
		
		
		
	[logger] Fix bug causing global log level to be overwritten (#8248)
This commit is contained in:
		
				
					committed by
					
						 Jesse Hills
						Jesse Hills
					
				
			
			
				
	
			
			
			
						parent
						
							1111aa167f
						
					
				
				
					commit
					92ad6286aa
				
			| @@ -247,8 +247,8 @@ async def to_code(config): | |||||||
|         ) |         ) | ||||||
|     cg.add(log.pre_setup()) |     cg.add(log.pre_setup()) | ||||||
|  |  | ||||||
|     for tag, level in config[CONF_LOGS].items(): |     for tag, log_level in config[CONF_LOGS].items(): | ||||||
|         cg.add(log.set_log_level(tag, LOG_LEVELS[level])) |         cg.add(log.set_log_level(tag, LOG_LEVELS[log_level])) | ||||||
|  |  | ||||||
|     cg.add_define("USE_LOGGER") |     cg.add_define("USE_LOGGER") | ||||||
|     this_severity = LOG_LEVEL_SEVERITY.index(level) |     this_severity = LOG_LEVEL_SEVERITY.index(level) | ||||||
|   | |||||||
| @@ -102,9 +102,6 @@ void Logger::log_vprintf_(int level, const char *tag, int line, const __FlashStr | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| int HOT Logger::level_for(const char *tag) { | int HOT Logger::level_for(const char *tag) { | ||||||
|   // Uses std::vector<> for low memory footprint, though the vector |  | ||||||
|   // could be sorted to minimize lookup times. This feature isn't used that |  | ||||||
|   // much anyway so it doesn't matter too much. |  | ||||||
|   if (this->log_levels_.count(tag) != 0) |   if (this->log_levels_.count(tag) != 0) | ||||||
|     return this->log_levels_[tag]; |     return this->log_levels_[tag]; | ||||||
|   return this->current_level_; |   return this->current_level_; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user