[Twisted-Python] logObservers and syslog proposal

Svein Seldal sveinse at seldal.com
Thu Jan 4 12:07:35 MST 2018


Hi

I'm currently working on understanding the twister.logger scheme with 
the purpose of getting proper logging in my end-user application.

https://gist.github.com/sveinse/041c69b6bbdde83cf5b00fecae3dcd50

It took me a while to get my head around the difference in using
twisted.logger.globalLogBeginner.beginLoggingTo() vs using 
twisted.logger.globalLogPublisher.addObserver(). Neither of the methods 
behave precisely as I'd like them to. See 
https://gist.github.com/sveinse/041c69b6bbdde83cf5b00fecae3dcd50#file-log-py-L99

1)
What are the intended difference between these two ways of installing a 
logobserver?


2)
I'd like to contribute a SyslogObserver for the new twister.logger 
scheme. See the _syslog.py file in the gist. It has been ported from the 
old logging scheme. Would this be useful to Twisted?

I was uncertain what to do with log_failures in the observer. I see that 
dumping of log_failures has been removed from t.l.FileLogObserver(). 
What is the appropriate way to deal with log_failures?

In the proposal of SyslogObserver I addded a dumpTraceback option to the 
constructor to select if the tb should go to the syslog or not. (My 
application shall have tb to syslog.)



Best regards,
Svein



More information about the Twisted-Python mailing list