Merge branch 'knaggita-issue1867'
This commit is contained in:
commit
899c819d8c
@ -176,6 +176,7 @@ Contributors, sorted by the number of commits in descending order:
|
||||
* Peter Vilim
|
||||
* Clayton Craft
|
||||
* Oliver Caldwell
|
||||
* knaggita
|
||||
* Jonas Schürmann
|
||||
* error800
|
||||
* Michael Hoang
|
||||
@ -200,7 +201,6 @@ Contributors, sorted by the number of commits in descending order:
|
||||
* Brian Jackson
|
||||
* sbinix
|
||||
* neeasade
|
||||
* knaggita
|
||||
* jnphilipp
|
||||
* Tobias Patzl
|
||||
* Stefan Tatschner
|
||||
|
@ -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,20 @@ 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 a list of: {}".format(
|
||||
logfilter, ', '.join(log.LOGGER_NAMES)))
|
||||
|
||||
|
||||
def main():
|
||||
parser = get_argparser()
|
||||
if sys.platform == 'darwin' and getattr(sys, 'frozen', False):
|
||||
|
Loading…
Reference in New Issue
Block a user