Skip to content

log_widget

_log_widget

Output log widget with ANSI color support.

Classes:

Name Description
FXOutputLogHandler

Custom logging handler that sends log messages to an output log widget.

FXOutputLogWidget

A reusable read-only output log widget for displaying application logs.

Classes

FXOutputLogHandler

FXOutputLogHandler(log_widget: FXOutputLogWidget)

Bases: Handler


              flowchart TD
              fxgui.fxwidgets._log_widget.FXOutputLogHandler[FXOutputLogHandler]

              

              click fxgui.fxwidgets._log_widget.FXOutputLogHandler href "" "fxgui.fxwidgets._log_widget.FXOutputLogHandler"
            

Custom logging handler that sends log messages to an output log widget.

This handler is used internally by FXOutputLogWidget to capture log messages and display them in the widget.

Parameters:

Name Type Description Default
log_widget
FXOutputLogWidget

The FXOutputLogWidget to send messages to.

required

Methods:

Name Description
emit

Emit a log record to the output log widget.

Functions
emit
emit(record: LogRecord) -> None

Emit a log record to the output log widget.

FXOutputLogWidget

FXOutputLogWidget(
    parent: Optional[QWidget] = None, capture_output: bool = False
)

Bases: QWidget


              flowchart TD
              fxgui.fxwidgets._log_widget.FXOutputLogWidget[FXOutputLogWidget]

              

              click fxgui.fxwidgets._log_widget.FXOutputLogWidget href "" "fxgui.fxwidgets._log_widget.FXOutputLogWidget"
            

A reusable read-only output log widget for displaying application logs.

This widget provides a text display area that captures and shows logging output from the application. It supports ANSI color codes, search functionality, and log throttling for performance.

Parameters:

Name Type Description Default
parent
Optional[QWidget]

Parent widget.

None
capture_output
bool

If True, adds a logging handler to capture log output from Python's logging module.

False
Signals

log_message: Emitted when a log message is received (for thread-safe delivery).

Examples:

>>> from fxgui import fxwidgets
>>> log_widget = fxwidgets.FXOutputLogWidget(capture_output=True)
>>> log_widget.show()

Initialize the output log widget.

Methods:

Name Description
append_log

Append text to the log output with ANSI color conversion.

clear_log

Clear the log output.

closeEvent

Handle widget close event to restore output streams.

keyPressEvent

Handle keyboard shortcuts.

restore_output_streams

Remove logging handler from all loggers where it was added.

Functions
append_log
append_log(text: str) -> None

Append text to the log output with ANSI color conversion.

Parameters:

Name Type Description Default
text str

Text to append (may contain ANSI color codes).

required
clear_log
clear_log() -> None

Clear the log output.

closeEvent
closeEvent(event: QCloseEvent) -> None

Handle widget close event to restore output streams.

keyPressEvent
keyPressEvent(event: QKeyEvent) -> None

Handle keyboard shortcuts.

restore_output_streams
restore_output_streams() -> None

Remove logging handler from all loggers where it was added.