From 608c0e50762bfced104c44199f4740befcaa8d7c Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Fri, 12 Apr 2019 00:48:46 +0200 Subject: [PATCH] Allow to update logger (#1035) * Allow to update logger * Fix bug --- hassio/bootstrap.py | 3 ++- hassio/config.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hassio/bootstrap.py b/hassio/bootstrap.py index 9ba8af4c2..8b37525b7 100644 --- a/hassio/bootstrap.py +++ b/hassio/bootstrap.py @@ -120,7 +120,8 @@ def initialize_system_data(coresys): _LOGGER.info("Create Hass.io Apparmor folder %s", config.path_apparmor) config.path_apparmor.mkdir() - return config + # Update log level + coresys.config.modify_log_level() def migrate_system_env(coresys): diff --git a/hassio/config.py b/hassio/config.py index 4fc4b819d..ca386a7b8 100644 --- a/hassio/config.py +++ b/hassio/config.py @@ -91,6 +91,12 @@ class CoreConfig(JsonConfig): def logging(self, value: str): """Set system log level.""" self._data[ATTR_LOGGING] = value + self.modify_log_level() + + def modify_log_level(self) -> None: + """Change log level.""" + lvl = getattr(logging, self.logging.upper()) + logging.basicConfig(level=lvl) @property def last_boot(self):