Commit d37b3536 authored by Matt Traudt's avatar Matt Traudt Committed by Matt Traudt
Browse files

Add way to override log level with an argument

parent db56d092
......@@ -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:
......
......@@ -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')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment