Add :debug-log-filter none
This allows us to clear any filters. Useful for users, and needed for the tests.
This commit is contained in:
parent
200e439a30
commit
e7755f5d9f
@ -24,6 +24,8 @@ Added
|
|||||||
- New `ui -> keyhint-delay` setting to configure the delay until
|
- New `ui -> keyhint-delay` setting to configure the delay until
|
||||||
the keyhint overlay pops up.
|
the keyhint overlay pops up.
|
||||||
- New `-s` option for `:open` to force a HTTPS scheme.
|
- New `-s` option for `:open` to force a HTTPS scheme.
|
||||||
|
- `:debug-log-filter` now accepts `none` as an argument to clear any log
|
||||||
|
filters.
|
||||||
|
|
||||||
Changed
|
Changed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -293,16 +293,22 @@ def debug_log_filter(filters: str):
|
|||||||
"""Change the log filter for console logging.
|
"""Change the log filter for console logging.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
filters: A comma separated list of logger names.
|
filters: A comma separated list of logger names. Can also be "none" to
|
||||||
|
clear any existing filters.
|
||||||
"""
|
"""
|
||||||
|
if log.console_filter is None:
|
||||||
|
raise cmdexc.CommandError("No log.console_filter. Not attached "
|
||||||
|
"to a console?")
|
||||||
|
|
||||||
|
if filters.strip().lower() == 'none':
|
||||||
|
log.console_filter.names = None
|
||||||
|
return
|
||||||
|
|
||||||
if not set(filters.split(',')).issubset(log.LOGGER_NAMES):
|
if not set(filters.split(',')).issubset(log.LOGGER_NAMES):
|
||||||
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(',')
|
log.console_filter.names = filters.split(',')
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,5 +166,8 @@ Feature: Miscellaneous utility commands exposed to the user.
|
|||||||
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
|
Scenario: Using debug-log-filter
|
||||||
When I run :debug-log-filter webview
|
When I run :debug-log-filter commands,ipc,webview
|
||||||
Then no crash should happen
|
And I run :enter-mode insert
|
||||||
|
And I run :debug-log-filter none
|
||||||
|
And I run :leave-mode
|
||||||
|
Then "Entering mode KeyMode.insert *" should not be logged
|
||||||
|
Loading…
Reference in New Issue
Block a user