[Python-Dev] PEP 282 Implementation

Vinay Sajip vinay_sajip@red-dove.com
Tue, 24 Sep 2002 00:04:15 +0100


Guido van Rossum wrote:
> I'm sorry that this seems to be a thread with one message per month!
> I'll try to be more responsive from now on, the big Zope projects that
> were keeping me busy have given me some slack time.

Great.

>> I will update the docstrings as per your feedback.
>
> Great!  (When can we see a new release on
> http://www.red-dove.com/python_logging.html
> ?)

I was waiting for your feedback about the packaging - the docstrings have
been changed but I wanted to roll everything into the next release. Speaking
of which...

> I would feel much less strongly about this if several of the
> additional things could be moved to separate files without making it a
> package.
>
[stuff snipped]

> This is an example of something that I'd like to see relegated to a
> separate file.  It really looks like fileConfig(), listen() and
> stopListening() are a separate feature bundle that looks like it is
> a specific example application rather than a core feature of the
> logging module.  It certainly doesn't appear in PEP 282.  Maybe the
> socket handler classes belong in the same category.
>
> Of course, the same can be said about all Handler subclasses except
> StreamHandler.  Only StreamHandler is referenced by basicConfig().
> Perhaps these should all (except StreamHandler) be moved to separate
> files?  This sounds like a reason to make it a package.  The main
> logging code could be in the __init__.py file -- there's no rule that
> says __init__.py should be empty or short!

How about this suggestion? We could leave the core code in the existing
module, "logging". This would include a minimal set of handlers, and all the
Filters, and I think StreamHandler and FileHandler should be in here. All
other handlers would live in "logging.handlers". As for configuration -
basicConfig() could live in "logging" and any other configuration code in
"logging.config".

If the above seems a good idea, please let me know and I'll refactor
accordingly - then the next release will (hopefully) be in the next 2-3
weeks.

> PS. In your comments you seem fond of the word "needful".  I've rarely
> heard that word -- perhaps it is archaic or common only in India?

I only found 2 uses of "needful" - in BufferingHandler and
ConfigStreamHandler. It's the whole phrase "do the needful", which I think
is peculiar to England but has its share of users on the subcontinent :-)

Regards


Vinay Sajip