diff options
-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) |