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

Vinay Sajip vinay_sajip at yahoo.co.uk
Sat Dec 11 07:18:57 CET 2010


Nick,

Thanks for the detailed exposition.

> Notice that even the recommended "basicConfig" approach to resolving
> this is subtly flawed, since your choices are to either display info

Right. basicConfig() is pretty basic.

> Basically, as of 3.2, the correct "default" use is likely to be:

The suggestions make sense.

> [1] As an exercise, I decided to actually configure recommended
> console logging output style via the logging module. It proved to be
> quite informative as to where some of the flaws in the current
> documentation lie.
[snip]
> documentation of Logger.setLevel()! There really should be a section
> early on in the logging documentation describing the root logger, how

Agreed.
 
> In addition to that, the documentation of the LogRecord class should
> really include a table of attribute names that are available for use
> in formatting and filtering. Initially I thought the attribute names

Yes.

> formatting (when the documentation for the new styles feature goes in
> would probably be an appropriate time to fix this). Similarly, the

Sorry, what do you mean by "new styles feature"?

> Anyway, the shortest way I could find of setting this up (debug

Yes, except that you could have set the root logger level to INFO rather than
DEBUG.

This raises some more questions. Obviously, we don't want users to have to go
through these steps themselves. Once these steps have been finalised, the last
resort handler could be modified to do all this. Should this handler be part of
the public API, so that it can be inherited from etc?

I realise we're in beta and hence feature freeze ... just sayin'. We're all
consenting adults here, after all :-)

Regards,

Vinay Sajip



More information about the Python-Dev mailing list