ESPHome 2025.10.3
Loading...
Searching...
No Matches
logger_level_select.h
Go to the documentation of this file.
1#pragma once
2
6
7namespace esphome::logger {
8class LoggerLevelSelect : public Component, public select::Select, public Parented<Logger> {
9 public:
10 void publish_state(int level);
11 void setup() override;
12 void control(const std::string &value) override;
13
14 protected:
15 // Convert log level to option index (skip CONFIG at level 4)
16 static uint8_t level_to_index(uint8_t level) { return (level > ESPHOME_LOG_LEVEL_CONFIG) ? level - 1 : level; }
17 // Convert option index to log level (skip CONFIG at level 4)
18 static uint8_t index_to_level(uint8_t index) { return (index >= ESPHOME_LOG_LEVEL_CONFIG) ? index + 1 : index; }
19};
20} // namespace esphome::logger
Helper class to easily give an object a parent of type T.
Definition helpers.h:712
static uint8_t level_to_index(uint8_t level)
void control(const std::string &value) override
static uint8_t index_to_level(uint8_t index)
Base-class for all selects.
Definition select.h:31