Use voluptuous for logger (#3375)

* Migrate to voluptuous

* No list for configuration check
pull/3424/merge
Fabian Affolter 2016-09-18 08:23:45 +02:00 committed by Paulus Schoutsen
parent a90049568e
commit 2b7d1fe20d
1 changed files with 15 additions and 0 deletions

View File

@ -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."""