Roundup Robot added the comment:
New changeset 16c15d7d4480 by Vinay Sajip in branch '2.7':
Issue #18541: simplified LoggerAdapter example.
http://hg.python.org/cpython/rev/16c15d7d4480
New changeset adaecee37745 by Vinay Sajip in branch '3.3':
Issue #18541: simplified LoggerAdapter example.
htt
Antoine Pitrou added the comment:
> > But how is that necessary for the use case? Your LoggerAdapter-
> > derived class could take the "existing class" as a constructor
> > parameter (*), then inject the required info in its overriden
> > process() method.
>
> If you can adapt an existing class
Vinay Sajip added the comment:
> I think we should acknowledge that people often have difficulties
> with the rather simple functionalities of the logging module,
> not only the advanced ones.
Perhaps some people do have difficulties, but that's always going to be the
case no matter what you do
Antoine Pitrou added the comment:
> That does not have a specific example, as it seems simple enough to
> understand as stated.
I think we should acknowledge that people often have difficulties
with the rather simple functionalities of the logging module,
not only the advanced ones.
> The examp
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
Log
New submission from Antoine Pitrou:
The idiomatic way to use a LoggerAdapter is to override the process() method.
However, the example in the cookbook (*) is some gobbledegook code overriding
__getitem__ and __iter__ on a separate class. It's a pity that users are
directed to use an insane and