This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vinay.sajip
Recipients docs@python, pitrou, vinay.sajip
Date 2013-07-24.13:45:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1374673547.79.0.153087683232.issue18541@psf.upfronthosting.co.za>
In-reply-to
Content
That's not quite right. The recommended way *is* to override the process() method. From the page you linked to:

"If you need a different method, e.g. if you want to prepend or append the contextual information to the message string, you just need to subclass LoggerAdapter and override process() to do what you need."

That does not have a specific example, as it seems simple enough to understand as stated.

The example you mention shows something else - how you would adapt an existing class (which might have information to go into the log) so that it could be passed (instead of a dict) to the LoggerAdapter initialiser. Possibly I could put this example into a separate section "Adapting an existing class to provide context information for logging" - this would make it clear that it's a separate use case and not the primary use case when using LoggerAdapter. The text seems clear enough,

"illustrates what dict-like behaviour is needed from an arbitrary ‘dict-like’ object for use in the constructor", but splitting it out into a separate section will make it easier for those who are speed-reading the docs.
History
Date User Action Args
2013-07-24 13:45:47vinay.sajipsetrecipients: + vinay.sajip, pitrou, docs@python
2013-07-24 13:45:47vinay.sajipsetmessageid: <1374673547.79.0.153087683232.issue18541@psf.upfronthosting.co.za>
2013-07-24 13:45:47vinay.sajiplinkissue18541 messages
2013-07-24 13:45:47vinay.sajipcreate