Skip to content

log

Class info

Classes

Name Children Inherits
UINotificationHandler
slashed.textual_adapter.log
Log handler that shows messages as Textual notifications.

    🛈 DocStrings

    Textual-specific log handler.

    UINotificationHandler

    Bases: Handler

    Log handler that shows messages as Textual notifications.

    Source code in src/slashed/textual_adapter/log.py
    class UINotificationHandler(logging.Handler):
        """Log handler that shows messages as Textual notifications."""
    
        def __init__(self, widget: Widget) -> None:
            super().__init__()
            self.widget = widget
    
        def emit(self, record: logging.LogRecord) -> None:
            try:
                # Only show debug/info as notifications
                if record.levelno <= logging.INFO:
                    self.widget.notify(self.format(record))
            except Exception:  # noqa: BLE001
                self.handleError(record)