-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Use voluptuous for logger #3375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cv.ensure_list, | ||
[ | ||
vol.Schema({ | ||
cv.string: vol.In(vol.Lower(list(LOGSEVERITY))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about making this cv.slug:
iso cv.string:
? It forces lowercase and allowable characters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cv.string
is correct. From the logger.getLogger(…)
docs:
Return a logger with the specified name or, if name is None, return a logger which is the root logger of the hierarchy. If specified, the name is typically a dot-separated hierarchical name like ‘a’, ‘a.b’ or ‘a.b.c.d’. Choice of these names is entirely up to the developer who is using logging.
One comment, but otherwise it looks good! 🐬 |
@@ -23,6 +27,22 @@ | |||
LOGGER_DEFAULT = 'default' | |||
LOGGER_LOGS = 'logs' | |||
|
|||
_LOGS_SCHEMA = vol.All( | |||
cv.ensure_list, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be a list, just the vol.Schema({…})
part is needed.
From the code line 84:
for key, value in config.get(DOMAIN)[LOGGER_LOGS].items():
…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that my brain went into a "there is a list" loop for the last vol PRs.
I am getting error output for my logger service now after this last rebase:
Seems I can no longer define a default log level. |
Description:
Migration of the configuration check to
voluptuous
.Related issue (if applicable): fixes 127528299
Example entry for
configuration.yaml
(if applicable):It would be nice if somebody could take a look at the changes and run a quick test. Thanks.