diff options
author | Florian Bruhin <me@the-compiler.org> | 2019-10-11 12:59:59 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2019-11-22 15:25:06 +0100 |
commit | 14d311a781a5863832bee4cbac26e548280c4c2f (patch) | |
tree | 632c6da56a9ee9127e3ac0ded6698115d722f4a4 | |
parent | 25e6f103457f89544f99bfcd62bbd78f8a4ce7f3 (diff) | |
download | qutebrowser-14d311a781a5863832bee4cbac26e548280c4c2f.tar.gz qutebrowser-14d311a781a5863832bee4cbac26e548280c4c2f.zip |
Fix :debug-log-level without a console attached
(cherry picked from commit 8ccea6e8000dbab70b66633167d3cea86e4de26e)
-rw-r--r-- | doc/changelog.asciidoc | 1 | ||||
-rw-r--r-- | qutebrowser/misc/utilcmds.py | 5 | ||||
-rw-r--r-- | qutebrowser/utils/log.py | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index a56a04694..fcf3d4718 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -37,6 +37,7 @@ Fixed relative basedirs. - Errors while reading the state file are now displayed instead of causing a crash. +- Crash when using `:debug-log-level` without a console attached. v1.8.1 (2019-09-27) ------------------- diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index 93cf20be8..cade12f0a 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -234,8 +234,11 @@ def debug_log_level(level: str) -> None: Args: level: The log level to set. """ + if log.console_handler is None: + raise cmdutils.CommandError("No log.console_handler. Not attached " + "to a console?") + log.change_console_formatter(log.LOG_LEVELS[level.upper()]) - assert log.console_handler is not None log.console_handler.setLevel(log.LOG_LEVELS[level.upper()]) diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index 168d5f52d..f1571566e 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -340,9 +340,7 @@ def change_console_formatter(level): Args: level: The numeric logging level """ - if not isinstance(console_handler.formatter, ColoredFormatter): - # JSON Formatter being used for end2end tests - pass + assert console_handler is not None use_colors = console_handler.formatter.use_colors console_fmt = get_console_format(level) |