QtHandler¶
class QtHandler(parent: Optional[QObject] = None, level: int = logging.ERROR)
Bases: Handler
Surface log records to the user as modal dialogs.
Attached to the root logger by poriscope.main_app.App.configure_logger()
alongside the console and file handlers.
The default level is ERROR, not NOTSET. Log severity is not a
statement about how the user should be interrupted: routine states legitimately
log at WARNING - an empty channel, a cold start with no analysis tabs
instantiated yet, an operation proceeding without an optional filter - and none
of those warrant a modal dialog. Anything the user should be told rather than
interrupted by belongs on the add_text_to_display panel instead.
Note poriscope.models.main_model.MainModel.update_logging_level()
deliberately skips this handler when it applies a new level to the root logger’s
handlers, so choosing a more verbose log level does not turn warnings back into
dialogs.
Public Methods¶
Abstract Methods¶
These methods must be implemented by subclasses.
(none)
Concrete Methods¶
- QtHandler.emit(record: LogRecord) None¶
Hand the record to the GUI thread.
- Parameters:
record (logging.LogRecord) – The record to display.
- QtHandler.show_message_box(record: LogRecord) None¶
Display one record, queueing any that arrive while a dialog is up.
A modal QMessageBox runs its own nested event loop, during which further queued records are still delivered here. They used to be dropped outright, so a burst of genuine errors showed the first and silently lost the rest - the empty-state path that logs twice in a row lost its second message every time. They are now queued and shown in turn once the dialog closes.
- Parameters:
record (logging.LogRecord) – The record to display.
Private Methods¶
Abstract Methods¶
These methods must be implemented by subclasses.
(none)