[Python-Dev] Using logging in the stdlib and its unit tests
v+python at g.nevcal.com
Fri Dec 10 09:36:57 CET 2010
On 12/9/2010 8:29 PM, Gregory P. Smith wrote:
> Exactly. All I ever recommend people do is:
> import logging
> logging.warn('doing something a bit odd.')
> for x in thing:
> logging.debug('working on %r', x)
> And be done with it. If they are controlling their __main__ they'll
> probably want to call a common function to setup the log message
> formatting and where it gets written to from there.
Greg -- can you flesh out that last line, to remove the need for my
parenthetical uncertainties below)?
So with your warn and debug calls, and the "common function to setup
..." (whatever this is, and however often and from where it needs to be
called in a multi-module environment) at the top of the logging manual,
it might be more approachable.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev