ESPHome 2025.9.0-dev
Loading...
Searching...
No Matches
logger_level_select.cpp
Go to the documentation of this file.
2
3namespace esphome::logger {
4
6 auto value = this->at(level);
7 if (!value) {
8 return;
9 }
10 Select::publish_state(value.value());
11}
12
14 this->parent_->add_listener([this](int level) { this->publish_state(level); });
15 this->publish_state(this->parent_->get_log_level());
16}
17
18void LoggerLevelSelect::control(const std::string &value) {
19 auto level = this->index_of(value);
20 if (!level)
21 return;
22 this->parent_->set_log_level(level.value());
23}
24
25} // namespace esphome::logger
void control(const std::string &value) override
optional< size_t > index_of(const std::string &option) const
Find the (optional) index offset of the provided option value.
Definition select.cpp:35
optional< std::string > at(size_t index) const
Return the (optional) option value at the provided index offset.
Definition select.cpp:52