example of logging w/ user-defined keywords?

Vinay Sajip vinay_sajip at yahoo.co.uk
Thu Apr 13 10:50:13 EDT 2006


Chris Curvey wrote:

> Several things that I've read lead me to think this is possible, but I
> can't figure out how to do it.  I have some information (a "job
> number")  that I would like logged on every log message, just like the
> time or the severity.
>
> I saw some mail threads that suggested that there was an easy way to do
> this, but I havent' found any examples.  Is there a simple way to do
> this, or do I need to write my own logger subclass?

The latest version in Subversion has an 'extra' keyword argument which
allows almost arbitrary items to be added to a LogRecord. See the
"in-development" docs at

http://docs.python.org/dev/lib/node365.html

and search for "extra".

Best regards,

Vinay Sajip




More information about the Python-list mailing list