On Tue, Nov 15, 2011 at 11:36 AM, Jeffrey Ollie <jeff@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
http://radix.twistedmatrix.com/
http://planet-if.com/