Skip to content

Commit 92ad628

Browse files
swoboda1337jesserockz
authored andcommitted
[logger] Fix bug causing global log level to be overwritten (#8248)
1 parent 1111aa1 commit 92ad628

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

esphome/components/logger/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ async def to_code(config):
247247
)
248248
cg.add(log.pre_setup())
249249

250-
for tag, level in config[CONF_LOGS].items():
251-
cg.add(log.set_log_level(tag, LOG_LEVELS[level]))
250+
for tag, log_level in config[CONF_LOGS].items():
251+
cg.add(log.set_log_level(tag, LOG_LEVELS[log_level]))
252252

253253
cg.add_define("USE_LOGGER")
254254
this_severity = LOG_LEVEL_SEVERITY.index(level)

esphome/components/logger/logger.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ void Logger::log_vprintf_(int level, const char *tag, int line, const __FlashStr
102102
#endif
103103

104104
int HOT Logger::level_for(const char *tag) {
105-
// Uses std::vector<> for low memory footprint, though the vector
106-
// could be sorted to minimize lookup times. This feature isn't used that
107-
// much anyway so it doesn't matter too much.
108105
if (this->log_levels_.count(tag) != 0)
109106
return this->log_levels_[tag];
110107
return this->current_level_;

0 commit comments

Comments
 (0)