From 1d5a3a617572f1c53f84da885753164463a4ef7f Mon Sep 17 00:00:00 2001 From: knaggita Date: Tue, 9 Aug 2016 14:56:26 +0300 Subject: [PATCH 01/13] Add :debug-loglevel :debug-logfilter commands --- qutebrowser/misc/utilcmds.py | 29 +++++++++++++++++++++++++++++ qutebrowser/utils/log.py | 26 +++++++++++++++++++++++++- tests/end2end/features/misc.feature | 2 +- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index e99ad45fb..e192cecda 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -256,3 +256,32 @@ def window_only(current_win_id): for win_id, window in objreg.window_registry.items(): if win_id != current_win_id: window.close() + + +@cmdutils.register(debug=True) +@cmdutils.argument('level', choices=[level.lower() + for level in log.LOG_LEVELS]) +def debug_log_level(level: str): + """Change the log level for console logging. + + Args: + level: log level for console log. + """ + log.console_handler.setLevel(log.LOG_LEVELS[level.upper()]) + + +@cmdutils.register(debug=True) +def debug_log_filter(filter_names: str): + """Change the log filter for console logging. + + Args: + filter_names: log filters for console log. + """ + if set(filter_names.split(',')).issubset(log.LOGGER_NAMES): + log.console_handler.removeFilter(log.console_filter) + log.console_filter = log.LogFilter(filter_names.split(',')) + log.console_handler.addFilter(log.console_filter) + else: + raise cmdexc.CommandError("Invalid argument, {} choose from {}". + format( + filter_names, ','.join(log.LOGGER_NAMES))) diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index 177c263f8..6fd9c4d62 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -87,6 +87,15 @@ LOG_LEVELS = { 'CRITICAL': logging.CRITICAL, } +LOGGER_NAMES = [ + 'statusbar', 'completion', 'init', 'url', + 'destroy', 'modes', 'webview', 'misc', + 'mouse', 'procs', 'hints', 'keyboard', + 'commands', 'signals', 'downloads', + 'js', 'qt', 'rfc6266', 'ipc', 'shlexer', + 'save', 'message', 'config', 'sessions' +] + def vdebug(self, msg, *args, **kwargs): """Log with a VDEBUG level. @@ -131,6 +140,8 @@ sessions = logging.getLogger('sessions') ram_handler = None +console_handler = None +console_filter = None def stub(suffix=''): @@ -149,6 +160,7 @@ class CriticalQtWarning(Exception): def init_log(args): """Init loggers based on the argparse namespace passed.""" + global console level = args.loglevel.upper() try: numeric_level = getattr(logging, level) @@ -161,9 +173,11 @@ def init_log(args): console, ram = _init_handlers(numeric_level, args.color, args.force_color, args.json_logging, args.loglines) root = logging.getLogger() + global console_filter if console is not None: if args.logfilter is not None: - console.addFilter(LogFilter(args.logfilter.split(','))) + console_filter = LogFilter(args.logfilter.split(',')) + console.addFilter(console_filter) root.addHandler(console) if ram is not None: root.addHandler(ram) @@ -175,6 +189,10 @@ def init_log(args): _log_inited = True +def change(filters): + console.addFilter(LogFilter(filters.split(','))) + + def _init_py_warnings(): """Initialize Python warning handling.""" warnings.simplefilter('default') @@ -210,6 +228,7 @@ def _init_handlers(level, color, force_color, json_logging, ram_capacity): json_logging: Output log lines in JSON (this disables all colors). """ global ram_handler + global console_handler console_fmt, ram_fmt, html_fmt, use_colorama = _init_formatters( level, color, force_color, json_logging) @@ -236,6 +255,11 @@ def _init_handlers(level, color, force_color, json_logging, ram_capacity): return console_handler, ram_handler +def change_loglevel(level): + value = LOG_LEVELS[level.upper()] + console_handler.setLevel(value) + + def _init_formatters(level, color, force_color, json_logging): """Init log formatters. diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index f8414999e..c61924de9 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -474,7 +474,7 @@ Feature: Various utility commands. ## https://github.com/The-Compiler/qutebrowser/issues/1523 Scenario: Completing a single option argument - When I run :set-cmd-text -s :-- + When I run :set-cmd-text -s :-- Then no crash should happen ## https://github.com/The-Compiler/qutebrowser/issues/1386 From bd6f4ae7c05f0673ecada9df8996013b87c240d2 Mon Sep 17 00:00:00 2001 From: knaggita Date: Fri, 12 Aug 2016 14:59:49 +0300 Subject: [PATCH 02/13] Add end2end tests issue52 --- tests/end2end/features/misc.feature | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index c61924de9..20b465c91 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -603,3 +603,27 @@ Feature: Various utility commands. And the following tabs should be open: - data/click_element.html - data/hello.txt (active) + + ## logfilter + + Scenario: Using :debug-log-filter with commands argument + When I run :debug-log-filter commands + And I run :message-info "Hello World" + Then the message "Hello World" should be shown + + Scenario: Using debug-log-filter with invalid filter + When I run :debug-log-filter hello + Then the error "Invalid argument, hello choose from statusbar,completion,init,url,destroy,modes,webview,misc,mouse,procs,hints,keyboard,commands,signals,downloads,js,qt,rfc6266,ipc,shlexer,save,message,config,sessions" should be shown + + Scenario: Using debug-log-level with invalid level + When I run :debug-log-level hello + Then the error "Invalid value hello - expected one of: debug, + error, vdebug, info, warning, critical" should be shown + + Scenario: :debug-log-level with warning argument + When I run :message-error the-error-message + And I run :message-warning the-warning-message + And I run :message-info the-info-message + And I run :debug-log-level warning + Then the error "the-error-message" should be shown + And the warning "the-warning-message" should be shown From 37758131f511994baec66eeee8c18a57ac4fa48a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 14:43:42 +0200 Subject: [PATCH 03/13] Delete broken :debug-log-{filter,level} tests --- tests/end2end/features/misc.feature | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 20b465c91..6e6f6f360 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -604,26 +604,10 @@ Feature: Various utility commands. - data/click_element.html - data/hello.txt (active) - ## logfilter - - Scenario: Using :debug-log-filter with commands argument - When I run :debug-log-filter commands - And I run :message-info "Hello World" - Then the message "Hello World" should be shown - - Scenario: Using debug-log-filter with invalid filter - When I run :debug-log-filter hello - Then the error "Invalid argument, hello choose from statusbar,completion,init,url,destroy,modes,webview,misc,mouse,procs,hints,keyboard,commands,signals,downloads,js,qt,rfc6266,ipc,shlexer,save,message,config,sessions" should be shown + # :debug-log-level + # Other :debug-log-{level,filter} features are tested in + # unit/utils/test_log.py as using them would break end2end tests. Scenario: Using debug-log-level with invalid level When I run :debug-log-level hello - Then the error "Invalid value hello - expected one of: debug, - error, vdebug, info, warning, critical" should be shown - - Scenario: :debug-log-level with warning argument - When I run :message-error the-error-message - And I run :message-warning the-warning-message - And I run :message-info the-info-message - And I run :debug-log-level warning - Then the error "the-error-message" should be shown - And the warning "the-warning-message" should be shown + Then the error "Invalid value hello - expected one of: debug, error, vdebug, info, warning, critical" should be shown From 75c3b1a9f8480e73ebf3164ca441d61f9a0d3025 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 14:57:21 +0200 Subject: [PATCH 04/13] Fix test for :debug-log-level with invalid level Since we're getting dictionary keys in choices=..., we need to sort them so we get a consistent message. --- qutebrowser/misc/utilcmds.py | 5 +++-- tests/end2end/features/misc.feature | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index e192cecda..84d666c58 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -259,8 +259,9 @@ def window_only(current_win_id): @cmdutils.register(debug=True) -@cmdutils.argument('level', choices=[level.lower() - for level in log.LOG_LEVELS]) +@cmdutils.argument('level', choices=sorted( + (level.lower() for level in log.LOG_LEVELS), + key=lambda e: log.LOG_LEVELS[e.upper()])) def debug_log_level(level: str): """Change the log level for console logging. diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 6e6f6f360..535c342aa 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -610,4 +610,4 @@ Feature: Various utility commands. Scenario: Using debug-log-level with invalid level When I run :debug-log-level hello - Then the error "Invalid value hello - expected one of: debug, error, vdebug, info, warning, critical" should be shown + Then the error "level: Invalid value hello - expected one of: vdebug, debug, info, warning, error, critical" should be shown From fd0965703e605aaaf75bd99c6bd47a4f64e418ed Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 14:57:55 +0200 Subject: [PATCH 05/13] Remove log.change_loglevel --- qutebrowser/utils/log.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index 6fd9c4d62..badf719bf 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -255,11 +255,6 @@ def _init_handlers(level, color, force_color, json_logging, ram_capacity): return console_handler, ram_handler -def change_loglevel(level): - value = LOG_LEVELS[level.upper()] - console_handler.setLevel(value) - - def _init_formatters(level, color, force_color, json_logging): """Init log formatters. From 71b0876188606911090d777518423ce508325aba Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 15:03:19 +0200 Subject: [PATCH 06/13] Improve :debug-log-filter message This changes the message so it resembles the default choices=... one, and also changes the argument to "filters" because that sounds nicer as a metavar. --- qutebrowser/misc/utilcmds.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index 84d666c58..e8324e2b8 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -272,17 +272,17 @@ def debug_log_level(level: str): @cmdutils.register(debug=True) -def debug_log_filter(filter_names: str): +def debug_log_filter(filters: str): """Change the log filter for console logging. Args: - filter_names: log filters for console log. + filters: log filters for console log. """ - if set(filter_names.split(',')).issubset(log.LOGGER_NAMES): + if set(filters.split(',')).issubset(log.LOGGER_NAMES): log.console_handler.removeFilter(log.console_filter) - log.console_filter = log.LogFilter(filter_names.split(',')) + log.console_filter = log.LogFilter(filters.split(',')) log.console_handler.addFilter(log.console_filter) else: - raise cmdexc.CommandError("Invalid argument, {} choose from {}". - format( - filter_names, ','.join(log.LOGGER_NAMES))) + raise cmdexc.CommandError("filters: Invalid value {} - expected one " + "of: {}".format(filters, + ', '.join(log.LOGGER_NAMES))) From 33e71525ed492be134a5bb1ce97e05ee4ae5b519 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 15:04:11 +0200 Subject: [PATCH 07/13] bdd: Test :debug-log-filter with invalid filter --- tests/end2end/features/misc.feature | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 535c342aa..a5b31db2a 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -604,10 +604,14 @@ Feature: Various utility commands. - data/click_element.html - data/hello.txt (active) - # :debug-log-level + # :debug-log-level / :debug-log-filter # Other :debug-log-{level,filter} features are tested in # unit/utils/test_log.py as using them would break end2end tests. Scenario: Using debug-log-level with invalid level When I run :debug-log-level hello Then the error "level: Invalid value hello - expected one of: vdebug, debug, info, warning, error, critical" should be shown + + Scenario: Using debug-log-filter with invalid filter + When I run :debug-log-filter blah + Then the error "filters: Invalid value blah - expected one of: statusbar, *" should be shown From 6781f6409bf84b6340af74331c7a60f29126f190 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 15:05:20 +0200 Subject: [PATCH 08/13] bdd: Test :debug-log-capacity with negative value --- tests/end2end/features/misc.feature | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index a5b31db2a..0e96aa3c3 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -471,6 +471,10 @@ Feature: Various utility commands. Then the page should contain the plaintext "newstuff" And the page should not contain the plaintext "oldstuff" + Scenario: Using :debug-log-capacity with negative capacity + When I run :debug-log-capacity -1 + Then the error "Can't set a negative log capacity!" should be shown + ## https://github.com/The-Compiler/qutebrowser/issues/1523 Scenario: Completing a single option argument From 3b897d6a64e20ce4e38ff99a1f46db16ea0176ca Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 15:05:45 +0200 Subject: [PATCH 09/13] bdd: Move :debug-log-* near :log-capacity tests --- tests/end2end/features/misc.feature | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 0e96aa3c3..39f44e31e 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -475,6 +475,18 @@ Feature: Various utility commands. When I run :debug-log-capacity -1 Then the error "Can't set a negative log capacity!" should be shown + # :debug-log-level / :debug-log-filter + # Other :debug-log-{level,filter} features are tested in + # unit/utils/test_log.py as using them would break end2end tests. + + Scenario: Using debug-log-level with invalid level + When I run :debug-log-level hello + Then the error "level: Invalid value hello - expected one of: vdebug, debug, info, warning, error, critical" should be shown + + Scenario: Using debug-log-filter with invalid filter + When I run :debug-log-filter blah + Then the error "filters: Invalid value blah - expected one of: statusbar, *" should be shown + ## https://github.com/The-Compiler/qutebrowser/issues/1523 Scenario: Completing a single option argument @@ -607,15 +619,3 @@ Feature: Various utility commands. And the following tabs should be open: - data/click_element.html - data/hello.txt (active) - - # :debug-log-level / :debug-log-filter - # Other :debug-log-{level,filter} features are tested in - # unit/utils/test_log.py as using them would break end2end tests. - - Scenario: Using debug-log-level with invalid level - When I run :debug-log-level hello - Then the error "level: Invalid value hello - expected one of: vdebug, debug, info, warning, error, critical" should be shown - - Scenario: Using debug-log-filter with invalid filter - When I run :debug-log-filter blah - Then the error "filters: Invalid value blah - expected one of: statusbar, *" should be shown From e1cd905163360a1ea169b893eaa4876be85ba94a Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 15:06:08 +0200 Subject: [PATCH 10/13] Move :window-only below :debug-log-* in utilcmds --- qutebrowser/misc/utilcmds.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index e8324e2b8..dcb1ce7d0 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -249,15 +249,6 @@ def log_capacity(capacity: int): log.ram_handler.change_log_capacity(capacity) -@cmdutils.register() -@cmdutils.argument('current_win_id', win_id=True) -def window_only(current_win_id): - """Close all windows except for the current one.""" - for win_id, window in objreg.window_registry.items(): - if win_id != current_win_id: - window.close() - - @cmdutils.register(debug=True) @cmdutils.argument('level', choices=sorted( (level.lower() for level in log.LOG_LEVELS), @@ -286,3 +277,12 @@ def debug_log_filter(filters: str): raise cmdexc.CommandError("filters: Invalid value {} - expected one " "of: {}".format(filters, ', '.join(log.LOGGER_NAMES))) + + +@cmdutils.register() +@cmdutils.argument('current_win_id', win_id=True) +def window_only(current_win_id): + """Close all windows except for the current one.""" + for win_id, window in objreg.window_registry.items(): + if win_id != current_win_id: + window.close() From 7e3d1ccd2437f4cd34595141bfb0ef3e650bd8ea Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 15:08:15 +0200 Subject: [PATCH 11/13] Simplify :debug-log-filter implementation --- qutebrowser/misc/utilcmds.py | 4 +--- qutebrowser/utils/log.py | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index dcb1ce7d0..20fce5e47 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -270,9 +270,7 @@ def debug_log_filter(filters: str): filters: log filters for console log. """ if set(filters.split(',')).issubset(log.LOGGER_NAMES): - log.console_handler.removeFilter(log.console_filter) - log.console_filter = log.LogFilter(filters.split(',')) - log.console_handler.addFilter(log.console_filter) + log.console_filter.names = filters.split(',') else: raise cmdexc.CommandError("filters: Invalid value {} - expected one " "of: {}".format(filters, diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index badf719bf..1ee91bad5 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -467,16 +467,16 @@ class LogFilter(logging.Filter): def __init__(self, names): super().__init__() - self._names = names + self.names = names def filter(self, record): """Determine if the specified record is to be logged.""" - if self._names is None: + if self.names is None: return True if record.levelno > logging.DEBUG: # More important than DEBUG, so we won't filter at all return True - for name in self._names: + for name in self.names: if record.name == name: return True elif not record.name.startswith(name): From 5367434a13e8c26874cffa42f2bf569d27d5110c Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 15:20:08 +0200 Subject: [PATCH 12/13] Add a unit test for :debug-log-filter --- tests/unit/utils/test_log.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/unit/utils/test_log.py b/tests/unit/utils/test_log.py index 4bf12c526..c386b9694 100644 --- a/tests/unit/utils/test_log.py +++ b/tests/unit/utils/test_log.py @@ -29,6 +29,7 @@ import pytest import pytest_catchlog from qutebrowser.utils import log +from qutebrowser.misc import utilcmds @pytest.yield_fixture(autouse=True) @@ -167,6 +168,19 @@ class TestLogFilter: record = self._make_record(logger, "bacon", level=logging.INFO) assert logfilter.filter(record) + @pytest.mark.parametrize('category, logged_before, logged_after', [ + ('init', True, False), ('url', False, True), ('js', False, True)]) + def test_debug_log_filter_cmd(self, monkeypatch, logger, category, + logged_before, logged_after): + logfilter = log.LogFilter(["init"]) + monkeypatch.setattr(log, 'console_filter', logfilter) + + record = self._make_record(logger, category) + + assert logfilter.filter(record) == logged_before + utilcmds.debug_log_filter('url,js') + assert logfilter.filter(record) == logged_after + class TestRAMHandler: From e074192cc47e7f0b62efd63d9b697bea0d01d9f9 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 19 Aug 2016 15:27:56 +0200 Subject: [PATCH 13/13] Update docs --- CHANGELOG.asciidoc | 2 ++ README.asciidoc | 2 +- doc/help/commands.asciidoc | 20 ++++++++++++++++++++ qutebrowser/misc/utilcmds.py | 5 +++-- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index a11969268..d16e7570a 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -39,6 +39,8 @@ Added to focus the previous/next category in the completion (bound to `` and `` by default). - New `:click-element` command to fake a click on a element. +- New `:debug-log-filter` command to change console log filtering on-the-fly. +- New `:debug-log-level` command to change the console loglevel on-the-fly. Changed ~~~~~~~ diff --git a/README.asciidoc b/README.asciidoc index ebcc58316..6af28d775 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -199,6 +199,7 @@ Contributors, sorted by the number of commits in descending order: * Brian Jackson * sbinix * neeasade +* knaggita * jnphilipp * Tobias Patzl * Stefan Tatschner @@ -224,7 +225,6 @@ Contributors, sorted by the number of commits in descending order: * zwarag * xd1le * oniondreams -* knaggita * issue * haxwithaxe * evan diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index e73d6cf80..eb76fa84f 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -1449,6 +1449,8 @@ These commands are mainly intended for debugging. They are hidden if qutebrowser |<>|Crash for debugging purposes. |<>|Dump the current page's content to a file. |<>|Change the number of log lines to be stored in RAM. +|<>|Change the log filter for console logging. +|<>|Change the log level for console logging. |<>|Evaluate a python string and display the results as a web page. |<>|Put data into the fake clipboard and enable logging, used for tests. |<>|Trace executed code via hunter. @@ -1500,6 +1502,24 @@ Change the number of log lines to be stored in RAM. ==== positional arguments * +'capacity'+: Number of lines for the log. +[[debug-log-filter]] +=== debug-log-filter +Syntax: +:debug-log-filter 'filters'+ + +Change the log filter for console logging. + +==== positional arguments +* +'filters'+: A comma separated list of logger names. + +[[debug-log-level]] +=== debug-log-level +Syntax: +:debug-log-level 'level'+ + +Change the log level for console logging. + +==== positional arguments +* +'level'+: The log level to set. + [[debug-pyeval]] === debug-pyeval Syntax: +:debug-pyeval [*--quiet*] 's'+ diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index 20fce5e47..4d9ebb4a3 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -22,6 +22,7 @@ import functools import types import traceback +import logging try: import hunter @@ -257,7 +258,7 @@ def debug_log_level(level: str): """Change the log level for console logging. Args: - level: log level for console log. + level: The log level to set. """ log.console_handler.setLevel(log.LOG_LEVELS[level.upper()]) @@ -267,7 +268,7 @@ def debug_log_filter(filters: str): """Change the log filter for console logging. Args: - filters: log filters for console log. + filters: A comma separated list of logger names. """ if set(filters.split(',')).issubset(log.LOGGER_NAMES): log.console_filter.names = filters.split(',')