On Mar 14, 7:40 am, Adrian Casey <m...@agcasey.com> wrote: > I have a multi-threaded PyQt4 application which has both a GUI and command- > line interface. I am using Qt4's threading because from what I have read, > it is more efficient than the native python threading module. Also, given > most users will probably use the GUI, it seemed to make sense. > > I want a flexible, threadsafeloggingfacility for my application so I was > thinking of using python'sloggingmodule. I need a logger that can log to > the GUI or a terminal depending on how the application is invoked. > > So, my question is -: > > Is it wise to use python'sloggingmodule in conjunction with Qt4 threads? > If not, what are my options apart from writing my ownloggingmodule? > > If it is OK, then I would like to know how to subclass theloggingclass so > that instead of sending output to stdout (as in StreamHandler), it emits Qt4 > signals instead. > > Any help would be appreciated. > > Thank you. > Adrian Casey.
Logging certainly works well with PyQt4 in multi-threaded applications, though of course it's based on Python's threading API rather than Qt's. To direct logging output to a GUI, it would be appropriate to develop a Qt/PyQt-aware handler class (derived from logging.Handler) to do the Qt interfacing. Regards, Vinay Sajip -- http://mail.python.org/mailman/listinfo/python-list