mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 07:07:28 +00:00
Use voluptuous for logger (#3375)
* Migrate to voluptuous * No list for configuration check
This commit is contained in:
parent
a90049568e
commit
2b7d1fe20d
@ -7,6 +7,10 @@ https://home-assistant.io/components/logger/
|
|||||||
import logging
|
import logging
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
import voluptuous as vol
|
||||||
|
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
DOMAIN = 'logger'
|
DOMAIN = 'logger'
|
||||||
|
|
||||||
LOGSEVERITY = {
|
LOGSEVERITY = {
|
||||||
@ -23,6 +27,17 @@ LOGSEVERITY = {
|
|||||||
LOGGER_DEFAULT = 'default'
|
LOGGER_DEFAULT = 'default'
|
||||||
LOGGER_LOGS = 'logs'
|
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):
|
class HomeAssistantLogFilter(logging.Filter):
|
||||||
"""A log filter."""
|
"""A log filter."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user