[Twisted-Python] logging (was: "Injecting" ...)

Jean-Paul Calderone exarkun at divmod.com
Wed Aug 2 07:52:09 MDT 2006


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




More information about the Twisted-Python mailing list