[Python-Dev] Using logging in the stdlib and its unit tests

Paul Moore p.f.moore at gmail.com
Thu Dec 9 00:06:46 CET 2010

On 8 December 2010 19:04, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
> Paul Moore <p.f.moore <at> gmail.com> writes:
>> On 8 December 2010 14:52, Nick Coghlan <ncoghlan <at> gmail.com> wrote:
>> > As I see it, there aren't many cases at the *library* level where
>> > logging errors is more appropriate than raising exceptions:
>> On a slightly tangential note, what do you think of the idea of
>> library code including info or debug level logging? In effect, tracing
>> and diagnostic code built in and available simply by changing the
>> logging level?
> That's how it works right now. You get info() and debug() messages sent via
> calls in library code, just by changing the level of (say) the root logger.

You misunderstand me. I know that's how those levels work. What I'm
not sure about (and I think would be interesting and potentially
useful information) is whether the individuals participating in this
thread feel that liberal use of info and debug level logging in
library code is useful. All the discussion thus far has been about
warning and error levels (mainly because people seem less comfortable
with the "suppress by default" approach for those levels, whereas it's
natural for debug and info levels).

I guess I'm wondering what best practices for logging might be.
(Actually, that might make the subject of an interesting blog posting,
if you're looking for suggestions :-)).


More information about the Python-Dev mailing list