Skip to content

Relay logged events from python's logging module to a PySide6 application via a QtCore.Signal.

License

Notifications You must be signed in to change notification settings

mjiggidy/qtlogrelay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qtlogrelay

qtlogrelay is a python module for the QtLogRelayHandler class.

QtLogRelayHandler is a logging.Handler which relays logged events from python's logging module to a PySide6 application via a QtCore.Signal.

Basic Usage

Create an instance of QtLogRelayHandler and install it as a log handler for your python logger.
Then connect the QtLogRelayHandler.logEventReceived signal to an appropriate slot to do what you need to do in your PySide6 application.

# Add a `QtLogRelayHandler` to this module's logger

qtloghandler = QtLogRelayHandler()
logging.getLogger(__name__).addHandler(qtloghandler)

# Now we can connect to that handler's signal to do stuff with the `logging.LogRecord` object

qtloghandler.logEventReceived.connect(
    processLogRecord,
    QtCore.Qt.ConnectionType.QueuedConnection
)

See examples/basic.py for a functioning example.

About

Relay logged events from python's logging module to a PySide6 application via a QtCore.Signal.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages