[Twisted-Python] logging question

Christopher Armstrong radix at twistedmatrix.com
Tue Nov 15 11:57:43 EST 2011

On Tue, Nov 15, 2011 at 11:36 AM, Jeffrey Ollie <jeff at ocjtech.us> wrote:

> I'm using twisted.python.log to do some logging in an application.
> It's formatting the output like "<date> [-] <mymessage>".  I've seen
> in some of my other applications that the contents of "[-]" can change
> depending on how the code is reached.  Is there a way that I can
> customize this in my application?  I'd like to change the contents to
> reflect the particular object that is generating the log message.
If you pass a 'system' kwarg to log.msg then it will go in that field.

log.msg("hi", system="stuff") results in <date> [stuff] hi

In my applications I usually hack the default log context stuff to disable
the inferred systems because they end up just being misleading and
inconsistent anyway.

Christopher Armstrong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20111115/78012867/attachment.htm 

More information about the Twisted-Python mailing list