[docs] [issue18541] LoggerAdapter example is counter-productive
Antoine Pitrou
report at bugs.python.org
Wed Jul 24 15:57:05 CEST 2013
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 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.
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.
(*) either by overriding the constructor, or simply by passing the
"existing class" as an entry in the "extra" dict.
If I had trusted your doc blindly, I would have thought it necessary
to go through the "complicated scheme", while the simple scheme is
actually sufficient to add per-connection info to log messages.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18541>
_______________________________________
More information about the docs
mailing list