Fix crash of :debug-log-filter when --filter wasn't given
There was no `LogFilter`. The fix is to always initialize a `LogFilter()` with `None`. as the "filter". Fixes #2303.
This commit is contained in:
parent
6c8ca30766
commit
200e439a30
@ -52,6 +52,7 @@ Fixed
|
|||||||
- Crash when pressing ctrl-c while a config error is shown
|
- Crash when pressing ctrl-c while a config error is shown
|
||||||
- Crash when the key config isn't writable
|
- Crash when the key config isn't writable
|
||||||
- Crash when unbinding an unbound key in the key config
|
- Crash when unbinding an unbound key in the key config
|
||||||
|
- Crash when using `:debug-log-filter` when `--filter` wasn't given on startup.
|
||||||
- Various rare crashes
|
- Various rare crashes
|
||||||
|
|
||||||
v0.10.1
|
v0.10.1
|
||||||
|
@ -295,13 +295,16 @@ def debug_log_filter(filters: str):
|
|||||||
Args:
|
Args:
|
||||||
filters: A comma separated list of logger names.
|
filters: A comma separated list of logger names.
|
||||||
"""
|
"""
|
||||||
if set(filters.split(',')).issubset(log.LOGGER_NAMES):
|
if not set(filters.split(',')).issubset(log.LOGGER_NAMES):
|
||||||
log.console_filter.names = filters.split(',')
|
|
||||||
else:
|
|
||||||
raise cmdexc.CommandError("filters: Invalid value {} - expected one "
|
raise cmdexc.CommandError("filters: Invalid value {} - expected one "
|
||||||
"of: {}".format(filters,
|
"of: {}".format(filters,
|
||||||
', '.join(log.LOGGER_NAMES)))
|
', '.join(log.LOGGER_NAMES)))
|
||||||
|
|
||||||
|
if log.console_filter is None:
|
||||||
|
raise cmdexc.CommandError("No log.console_filter. Not attached "
|
||||||
|
"to a console?")
|
||||||
|
log.console_filter.names = filters.split(',')
|
||||||
|
|
||||||
|
|
||||||
@cmdutils.register()
|
@cmdutils.register()
|
||||||
@cmdutils.argument('current_win_id', win_id=True)
|
@cmdutils.argument('current_win_id', win_id=True)
|
||||||
|
@ -182,9 +182,10 @@ def init_log(args):
|
|||||||
root = logging.getLogger()
|
root = logging.getLogger()
|
||||||
global console_filter
|
global console_filter
|
||||||
if console is not None:
|
if console is not None:
|
||||||
|
console_filter = LogFilter(None)
|
||||||
if args.logfilter is not None:
|
if args.logfilter is not None:
|
||||||
console_filter = LogFilter(args.logfilter.split(','))
|
console_filter.names = args.logfilter.split(',')
|
||||||
console.addFilter(console_filter)
|
console.addFilter(console_filter)
|
||||||
root.addHandler(console)
|
root.addHandler(console)
|
||||||
if ram is not None:
|
if ram is not None:
|
||||||
root.addHandler(ram)
|
root.addHandler(ram)
|
||||||
|
@ -164,3 +164,7 @@ Feature: Miscellaneous utility commands exposed to the user.
|
|||||||
Scenario: Using debug-log-filter with invalid filter
|
Scenario: Using debug-log-filter with invalid filter
|
||||||
When I run :debug-log-filter blah
|
When I run :debug-log-filter blah
|
||||||
Then the error "filters: Invalid value blah - expected one of: statusbar, *" should be shown
|
Then the error "filters: Invalid value blah - expected one of: statusbar, *" should be shown
|
||||||
|
|
||||||
|
Scenario: Using debug-log-filter
|
||||||
|
When I run :debug-log-filter webview
|
||||||
|
Then no crash should happen
|
||||||
|
Loading…
Reference in New Issue
Block a user