mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-05 13:32:32 +12:00
Catch indexing issue in log level conversion
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
parent
9a4aa314e8
commit
e45314ba2d
|
@ -218,10 +218,12 @@ from PyQt5.Qt import QtMsgType
|
||||||
def qtMessageHandler(msg_type, msg_log_context, msg_string):
|
def qtMessageHandler(msg_type, msg_log_context, msg_string):
|
||||||
"""Forwards Qt messages to Python logging system."""
|
"""Forwards Qt messages to Python logging system."""
|
||||||
# Convert Qt msg type to logging level
|
# Convert Qt msg type to logging level
|
||||||
log_level = [logging.DEBUG,
|
msg_type_index = int(msg_type)
|
||||||
logging.WARNING,
|
log_levels = [logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.FATAL]
|
||||||
logging.ERROR,
|
if (msg_type_index >= 0) and (msg_type_index < len(log_levels)):
|
||||||
logging.FATAL] [ int(msg_type) ]
|
log_level = log_levels[msg_type_index]
|
||||||
|
else:
|
||||||
|
log_level = log_levels[-1]
|
||||||
qtcl = logging.getLogger(msg_log_context.category or "qt.???")
|
qtcl = logging.getLogger(msg_log_context.category or "qt.???")
|
||||||
# Some information may not be available unless using a PyQt debug build.
|
# Some information may not be available unless using a PyQt debug build.
|
||||||
# See: https://www.riverbankcomputing.com/static/Docs/PyQt5/api/qtcore/qmessagelogcontext.html
|
# See: https://www.riverbankcomputing.com/static/Docs/PyQt5/api/qtcore/qmessagelogcontext.html
|
||||||
|
|
Loading…
Reference in a new issue