Skip to content

Instantly share code, notes, and snippets.

Created May 29, 2013 19:31
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save chiiph/5673107 to your computer and use it in GitHub Desktop.
import sys
import logging
from functools import partial
from PySide import QtCore, QtGui
class Obj(QtCore.QObject, logging.Handler):
sig = QtCore.Signal(dict)
def __init__(self):
def emit(self, logRecord):
# This is intended to be logging.Handler
# implementation of emit, not the QObject one
self.sig.emit({"a":123, "b":321})
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
handler = Obj()
logger = logging.getLogger(name='test')
w = QtGui.QWidget()
b = QtGui.QPushButton(w)
b.clicked.connect(partial(logger.debug, "ASD"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment