Skip to content

Commit 69f2879

Browse files
committed
Strip out old logging options
1 parent 9f5b1c6 commit 69f2879

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

custom_components/maint/__init__.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
from homeassistant.helpers import config_validation as cv
1010

1111
from .const import (
12-
CONF_LOG_LEVEL,
13-
DEFAULT_LOG_LEVEL,
1412
DEFAULT_TITLE,
1513
DOMAIN,
1614
)
@@ -21,10 +19,6 @@
2119
CONFIG_SCHEMA = cv.config_entry_only_config_schema(DOMAIN)
2220
PLATFORMS: list[Platform] = [Platform.BINARY_SENSOR, Platform.SENSOR]
2321
_LOGGER = logging.getLogger(__name__)
24-
LOG_LEVEL_MAP = {
25-
"debug": logging.DEBUG,
26-
"info": logging.INFO,
27-
}
2822

2923
if TYPE_CHECKING:
3024
from homeassistant.config_entries import ConfigEntry
@@ -35,7 +29,6 @@
3529
async def async_setup(hass: HomeAssistant, _config: ConfigType) -> bool:
3630
"""Set up Maint."""
3731
data = hass.data.setdefault(DOMAIN, {})
38-
_apply_log_level(DEFAULT_LOG_LEVEL)
3932
_LOGGER.info("Setting up Maint integration")
4033
await _async_get_task_store(hass)
4134
await async_register_panel(hass)
@@ -48,12 +41,9 @@ async def async_setup(hass: HomeAssistant, _config: ConfigType) -> bool:
4841

4942
async def async_setup_entry(hass: HomeAssistant, entry: MaintConfigEntry) -> bool:
5043
"""Set up Maint from a config entry."""
51-
configured_level = entry.options.get(CONF_LOG_LEVEL, DEFAULT_LOG_LEVEL)
52-
_apply_log_level(configured_level)
5344
_LOGGER.info(
54-
"Setting up Maint config entry %s (log_level=%s)",
45+
"Setting up Maint config entry %s",
5546
entry.entry_id,
56-
configured_level,
5747
)
5848
if entry.unique_id is None:
5949
hass.config_entries.async_update_entry(entry, unique_id=DOMAIN)
@@ -102,18 +92,3 @@ async def _async_get_task_store(hass: HomeAssistant) -> MaintTaskStore:
10292
else:
10393
_LOGGER.debug("Reusing existing Maint task store")
10494
return store
105-
106-
107-
def _apply_log_level(log_level: str) -> None:
108-
"""Apply the configured log level for Maint loggers."""
109-
level = LOG_LEVEL_MAP.get(log_level.lower(), logging.INFO)
110-
# Ensure the package logger and all Maint child loggers share the same level.
111-
package_prefix = f"{__package__}."
112-
for logger_name in list(logging.root.manager.loggerDict):
113-
if logger_name == __package__ or logger_name.startswith(package_prefix):
114-
logging.getLogger(logger_name).setLevel(level)
115-
_LOGGER.debug(
116-
"Applied Maint log level %s (%s)",
117-
log_level,
118-
level,
119-
)

custom_components/maint/const.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
DOMAIN = "maint"
44
DEFAULT_TITLE = "Maint"
5-
CONF_LOG_LEVEL = "log_level"
6-
DEFAULT_LOG_LEVEL = "info"
7-
LOG_LEVEL_OPTIONS = ("info", "debug")
85

96
WS_TYPE_KEY = "type"
107
WS_TYPE_TASK_CREATE = "maint/task/create"

0 commit comments

Comments
 (0)