summaryrefslogtreecommitdiff
path: root/qutebrowser/utils/log.py
diff options
context:
space:
mode:
Diffstat (limited to 'qutebrowser/utils/log.py')
-rw-r--r--qutebrowser/utils/log.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py
index ab94aa40d..c0da78b90 100644
--- a/qutebrowser/utils/log.py
+++ b/qutebrowser/utils/log.py
@@ -35,7 +35,7 @@ import argparse
from typing import (TYPE_CHECKING, Any, Iterator, Mapping, MutableSequence,
Optional, Set, Tuple, Union)
-from qutebrowser.qt import core as qtcore
+from qutebrowser.qt import core
# Optional imports
try:
import colorama
@@ -211,13 +211,13 @@ def init_log(args: argparse.Namespace) -> None:
root.setLevel(logging.NOTSET)
logging.captureWarnings(True)
_init_py_warnings()
- qtcore.qInstallMessageHandler(qt_message_handler)
+ core.qInstallMessageHandler(qt_message_handler)
_log_inited = True
-@qtcore.pyqtSlot()
+@core.pyqtSlot()
def shutdown_log() -> None:
- qtcore.qInstallMessageHandler(None)
+ core.qInstallMessageHandler(None)
def _init_py_warnings() -> None:
@@ -236,11 +236,11 @@ def _init_py_warnings() -> None:
@contextlib.contextmanager
def disable_qt_msghandler() -> Iterator[None]:
"""Contextmanager which temporarily disables the Qt message handler."""
- old_handler = qtcore.qInstallMessageHandler(None)
+ old_handler = core.qInstallMessageHandler(None)
try:
yield
finally:
- qtcore.qInstallMessageHandler(old_handler)
+ core.qInstallMessageHandler(old_handler)
@contextlib.contextmanager
@@ -378,8 +378,8 @@ def change_console_formatter(level: int) -> None:
assert isinstance(old_formatter, JSONFormatter), old_formatter
-def qt_message_handler(msg_type: qtcore.QtMsgType,
- context: qtcore.QMessageLogContext,
+def qt_message_handler(msg_type: core.QtMsgType,
+ context: core.QMessageLogContext,
msg: str) -> None:
"""Qt message handler to redirect qWarning etc. to the logging system.
@@ -392,11 +392,11 @@ def qt_message_handler(msg_type: qtcore.QtMsgType,
# Note we map critical to ERROR as it's actually "just" an error, and fatal
# to critical.
qt_to_logging = {
- qtcore.QtMsgType.QtDebugMsg: logging.DEBUG,
- qtcore.QtMsgType.QtWarningMsg: logging.WARNING,
- qtcore.QtMsgType.QtCriticalMsg: logging.ERROR,
- qtcore.QtMsgType.QtFatalMsg: logging.CRITICAL,
- qtcore.QtMsgType.QtInfoMsg: logging.INFO,
+ core.QtMsgType.QtDebugMsg: logging.DEBUG,
+ core.QtMsgType.QtWarningMsg: logging.WARNING,
+ core.QtMsgType.QtCriticalMsg: logging.ERROR,
+ core.QtMsgType.QtFatalMsg: logging.CRITICAL,
+ core.QtMsgType.QtInfoMsg: logging.INFO,
}
# Change levels of some well-known messages to debug so they don't get