Vinay Sajip added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18541>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to