On 20 May 2015 at 12:10, <exar...@twistedmatrix.com> wrote: > On 19 May, 04:38 pm, jerryguitar...@gmail.com wrote: >> >> Hi! >> >> I filed a ticket (Log the log events in twisted.internet.protocol.Factory >> using the new logging system <https://twistedmatrix.com/trac/ticket/7897>) >> and I have also submitted a patch for it. However, while working on the >> patch, I had some concerns that I have already summarized in a ticket >> comment. I would really appreciate it if someone could please take a look >> and give me some advice as to how to move further with this ticket so that >> I can start working on other patches for porting to twisted.logger. :-) > > > I think this question may indicate a certain section of documentation that > is missing for twisted.logger. > > Perhaps some folks who have ideas about how this new logging library should > be used could look at that ticket and then clarify some existing > twisted.logger docs or add something to them. > +1
I think that the trouble with twisted.logger documentation is that it looks like an independent project and is documented as such. It has no info/policy about how the logger and observers should be used in Twisted core code. To move things forward I suggest using a `_log` instance attribute to emit log events. It can be defined as the generic _log = Logger() class attribute similar to the current patch --------- http and socks factory already define their own log() method with different signatures. Those method are more like observers as they write the events in a file... outside of the old (or new) logging system. Maybe we can refactor the http and socks code to emit all event using _log() and use a dedicated log observer to persist the events in a file. --------- Having 'log' or '_log' in low level classes like Factory and Protocol might conflict with existing code written by Twisted users... but this might happen with any new method (public or private) added to the new Twisted versions With the new API docs formatting which hides private methods by default, we might want to have the log method public so that users will have a greater change to observer the method and prevent them from overwriting the method. Cheers -- Adi Roiban _______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python