From 2b7d1fe20de754c55fcf00bae91724d3e091dc4a Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sun, 18 Sep 2016 08:23:45 +0200 Subject: [PATCH] Use voluptuous for logger (#3375) * Migrate to voluptuous * No list for configuration check --- homeassistant/components/logger.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/homeassistant/components/logger.py b/homeassistant/components/logger.py index ed17e7520d0..58e745e3004 100644 --- a/homeassistant/components/logger.py +++ b/homeassistant/components/logger.py @@ -7,6 +7,10 @@ https://home-assistant.io/components/logger/ import logging from collections import OrderedDict +import voluptuous as vol + +import homeassistant.helpers.config_validation as cv + DOMAIN = 'logger' LOGSEVERITY = { @@ -23,6 +27,17 @@ LOGSEVERITY = { LOGGER_DEFAULT = 'default' LOGGER_LOGS = 'logs' +_LOGS_SCHEMA = vol.Schema({ + cv.string: vol.In(vol.Lower(list(LOGSEVERITY))), +}) + +CONFIG_SCHEMA = vol.Schema({ + DOMAIN: vol.Schema({ + vol.Required(LOGGER_DEFAULT): vol.In(vol.Lower(list(LOGSEVERITY))), + vol.Required(LOGGER_LOGS): _LOGS_SCHEMA, + }), +}, extra=vol.ALLOW_EXTRA) + class HomeAssistantLogFilter(logging.Filter): """A log filter."""