RE: [Twisted-Python] Use python logging module with Twisted log

The dictionary you get depends on whether it's log.msg or log.err. You can then do what you want with it.
A little bit of information, what keys can occurr and what they mean would be nice.
How about this (if self.log is a logging.Logger); code is partly stolen from twisted.python.log:
def twisted_logger(self, logdict): """ log observer for twisted.python.log, receives a dict and writes to self.log """ if 'failure' in logdict: text = logdict['failure'].getTraceback() else: text = " ".join([str(m) for m in logdict["message"]]) if logdict['isError']: self.log.error(text) else: self.log.warning(text)
Best regards, Henning Hraban Ramm Südkurier Medienhaus / MediaPro Support/Admin/Development Dept.
participants (1)
-
Henning.Ramm@mediapro-gmbh.de