[Python-Dev] Loggers in the stdlib and logging configuration APIs

Nick Coghlan ncoghlan at gmail.com
Tue Dec 28 09:55:42 CET 2010


On Tue, Dec 28, 2010 at 6:53 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Tue, Dec 28, 2010 at 6:28 PM, Glenn Linderman <v+python at g.nevcal.com> wrote:
>> On 12/28/2010 12:19 AM, Vinay Sajip wrote:
>>
>>> calls can support three levels of logger disabling:
>>> - leave all existing loggers enabled (existing option)
>>
>> I think you mean disabled - that's the current behaviour.
>>
>>> - leave only flagged loggers enabled (new default behaviour)
>>> - disable all loggers not mentioned explicitly (new option)
>>
>> My words in his mouth, but I think he meant that the existing _default_
>> behavior should be changed, and the existing option (listed first), which is
>> not default behaviour should be kept, and a third option to sort of achieve
>> the current default behavior, but make it harder.
>
> It isn't really about making it harder - it is about changing the
> default behaviour in a backwards compatible way.
>
> As I see it, library level loggers (including those in the standard
> library) should be left enabled unless explicitly turned off, while
> application level loggers should be left disabled unless explicitly
> turned on.

To put a bit more nuance on that view: if the library uses the logger
to report errors, it should *definitely* flag it to be implicitly
enabled. If it is only used for info messages, then preferences will
vary according to the library developer. The beauty of the logging
system is that application authors can get at the logging information
regardless of which default the library author chooses.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list