Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
sbws
Commits
15e6cdb7
Commit
15e6cdb7
authored
Jul 10, 2018
by
juga
Committed by
Matt Traudt
Jul 10, 2018
Browse files
Validate and use syslog format
parent
031a808d
Changes
1
Hide whitespace changes
Inline
Side-by-side
sbws/util/config.py
View file @
15e6cdb7
...
...
@@ -134,6 +134,7 @@ def configure_logging(args, conf):
# Set some stuff that needs config parser's interpolation
conf
[
'formatter_to_file'
][
'format'
]
=
conf
[
'logging'
][
'to_file_format'
]
conf
[
'formatter_to_stdout'
][
'format'
]
=
conf
[
'logging'
][
'to_stdout_format'
]
conf
[
'formatter_to_syslog'
][
'format'
]
=
conf
[
'logging'
][
'to_syslog_format'
]
conf
[
logger
][
'level'
]
=
conf
[
'logging'
][
'level'
].
upper
()
conf
[
'handler_to_file'
][
'level'
]
=
conf
[
'logging'
][
'to_file_level'
].
upper
()
conf
[
'handler_to_stdout'
][
'level'
]
=
\
...
...
@@ -294,7 +295,8 @@ def _validate_logging(conf):
'to_file_max_bytes'
:
{
'minimum'
:
0
,
'maximum'
:
None
},
'to_file_num_backups'
:
{
'minimum'
:
0
,
'maximum'
:
None
},
}
unvalidated
=
[
'format'
,
'to_file_format'
,
'to_stdout_format'
]
unvalidated
=
[
'format'
,
'to_file_format'
,
'to_stdout_format'
,
'to_syslog_format'
]
all_valid_keys
=
list
(
bools
.
keys
())
+
list
(
enums
.
keys
())
+
\
list
(
ints
.
keys
())
+
unvalidated
errors
.
extend
(
_validate_section_keys
(
conf
,
sec
,
all_valid_keys
,
err_tmpl
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment