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

Vinay Sajip vinay_sajip at yahoo.co.uk
Tue Dec 28 09:19:45 CET 2010


Nick Coghlan <ncoghlan <at> gmail.com> writes:

> Unfortunately, the "py" package already claimed that namespace, so it
> isn't really free for us to use in the standard library (even the
> current "py.warnings" for redirected warnings may be misleading, as it
> may give users the impression that package is involved somewhere along

Gosh, I had no idea the py package even existed.

> the line). It is probably best just to go with the "__name__"
> convention and not worry about being able to draw a clean distinction
> between "standard library" and "third party" (that distinction doesn't
> exist in the module heirarchy, so it isn't really reasonable to expect
> it to exist in the logging heirarchy).

True.

> However, rather than a manually maintained list of low level loggers,
> it may be feasible to just have a flag we can set on loggers that
> makes them immune to the default implicit disabling. Then the config

Yes, I thought about this option after I posted, using "leave_enabled" as the
attribute name, as well as possibly an API to register loggers for being skipped
by the disable logic. A logger flag is definitely easier all round.

> 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)

So far, this seems the best approach.

Thanks,

Vinay Sajip



More information about the Python-Dev mailing list