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
d37b3536
Commit
d37b3536
authored
Apr 16, 2018
by
Matt Traudt
Committed by
Matt Traudt
Apr 16, 2018
Browse files
Add way to override log level with an argument
parent
db56d092
Changes
2
Hide whitespace changes
Inline
Side-by-side
sbws/sbws.py
View file @
d37b3536
...
...
@@ -14,10 +14,17 @@ import logging
log
=
logging
.
getLogger
(
__name__
)
def
_adjust_log_level
(
args
,
conf
):
if
not
args
.
log_level
:
return
conf
[
'logger_sbws'
][
'level'
]
=
args
.
log_level
def
main
():
parser
=
create_parser
()
args
=
parser
.
parse_args
()
conf
=
get_config
(
args
)
_adjust_log_level
(
args
,
conf
)
conf_valid
,
conf_errors
=
validate_config
(
conf
)
if
not
conf_valid
:
for
e
in
conf_errors
:
...
...
sbws/util/parser.py
View file @
d37b3536
...
...
@@ -21,12 +21,9 @@ def create_parser():
p
.
add_argument
(
'--version'
,
action
=
'version'
,
help
=
'sbws version'
,
version
=
'%(prog)s {}'
.
format
(
version
))
p
.
add_argument
(
'-v'
,
'--verbose'
,
action
=
'count'
,
default
=
0
,
help
=
'Increase log level verbosity from the configured value'
)
p
.
add_argument
(
'-q'
,
'--quiet'
,
action
=
'count'
,
default
=
0
,
help
=
'Decrease log level verbosity from the configured value'
)
p
.
add_argument
(
'--log-level'
,
choices
=
[
'DEBUG'
,
'INFO'
,
'WARNING'
,
'ERROR'
,
'CRITICAL'
],
help
=
'Override the sbws log level'
)
p
.
add_argument
(
'-d'
,
'--directory'
,
default
=
_default_dot_sbws_dname
(),
help
=
'Name of the .sbws directory'
)
sub
=
p
.
add_subparsers
(
dest
=
'command'
)
...
...
Write
Preview
Supports
Markdown
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