[Twisted-Python] logging

Chaz. eprparadocs at gmail.com
Wed Aug 2 08:16:39 MDT 2006


Jean-Paul Calderone wrote:
> On Tue, 1 Aug 2006 18:36:29 -0400, glyph at divmod.com wrote:
>>
>> My long-term vision for log events is for every log message in Twisted 
>> to eventually go from looking like this:
>>
>>  log.msg("did some stuff %s %r" % (a, b))
>>
>> to looking like this:
>>
>>  log.msg(interface=IDidSomeStuff,
>>          format="did some stuff %(stuff)s %(morestuff)r",
>>          stuff=stuff,
>>          morestuff=morestuff))
>>
> 
> There's nothing preventing anyone from using twisted.python.log like this
> right now.  The implementation could be adjusted to provide better
> performance for this case but that's hardly a blocking issue preventing
> anyone from doing creative things with logging.
> 
> As you mentioned, Allen has effectively used it this way.
> 
> I think the real reason we don't see this usage more is that it is pretty
> advanced and most people *do* just want debug spew.  You have to get quite
> a ways into the development of a library or application before you start
> worrying about the things this functionality can help you with.
> 
> Oh, and I still think the format argument is redundant and stupid :)
> 
> Jean-Paul
> 
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 

I have a few questions about all this particularly since my application 
requires at least two different logs in the normal case and three in the 
debugging case (after all I don't want to mix debugging information with 
all the rest of the logs).

Why is the format "redundant and stupid"? Is it available someplace 
else? If so, I would love to know so that I could remove it from my usage.

In regards to 'interface' above is that how I would switch between 
different loggers?

Finally if I do all this why do I need t.p.l at all? I might as well 
just implement log.msg() myself. I could keep t.p.l for the debugging 
case and use my specialized code for the other two. Am I missing something?


Peace,
Chaz.






More information about the Twisted-Python mailing list