Merge branch 'issue1867' of https://github.com/knaggita/qutebrowser into knaggita-issue1867

This commit is contained in:
Florian Bruhin 2016-08-25 23:11:35 +02:00
commit 99daa9e165

View File

@ -23,6 +23,7 @@ import sys
import json
import qutebrowser
from qutebrowser.utils import log
try:
from qutebrowser.misc.checkpyver import check_python_version
except ImportError:
@ -81,7 +82,7 @@ def get_argparser():
help="Set loglevel", default='info',
choices=['critical', 'error', 'warning', 'info',
'debug', 'vdebug'])
debug.add_argument('--logfilter',
debug.add_argument('--logfilter', type=logfilter_error,
help="Comma-separated list of things to be logged "
"to the debug log on stdout.")
debug.add_argument('--loglines',
@ -139,6 +140,21 @@ def get_argparser():
return parser
def logfilter_error(logfilter: str):
"""Validate logger names passed to --logfilter.
Args:
logfilter: A comma separated list of logger names.
"""
if set(logfilter.split(',')).issubset(log.LOGGER_NAMES):
return logfilter
else:
raise argparse.ArgumentTypeError("filters: Invalid value {} - "
"expected one "
"of: {}".format(logfilter,
', '.join(log.LOGGER_NAMES)))
def main():
parser = get_argparser()
if sys.platform == 'darwin' and getattr(sys, 'frozen', False):