Improving logging, was Re: Optional use of logging library module

Peter Otten __peter__ at web.de
Wed Jun 30 06:01:12 EDT 2004


Vinay Sajip wrote:

> I'm curious to know what people don't like about the logging module. I
> haven't seen any posts on c.l.py complaining about it, can you point
> me to some discussions?

First of all: the logging package is *nice*, thank you for providing it.

Here are two older threads that may give you an idea what difficulties
people may encounter when learning to use it:
http://groups.google.com/groups?selm=mailman.130.1067255458.702.python-list%40python.org
http://groups.google.com/groups?selm=bp0vaq%247lc%241%40boulder.noaa.gov

What I would like to see: 

- A one-stop function to get output to a file or stream.

- A standard way to register custom handlers, something like
registerHandlerClass(klass, name=None), name defaulting to klass.__name__.
This would probably imply replacing eval() with a dictionary lookup.

- I find the programmatic interface easier to learn than the config-file
format. A utility function that writes the current configuration to a file
might help here.

- Let config-files and programmatic setup respect each other.

- Allow for multiple root loggers. Logging can be used for totally unrelated
tasks. I feel a little uneasy to have them all in the same hierarchy. (This
one is thinking aloud, I'm not even sure if this cannot be done already
with the Manager class) 
  
None of these are showstoppers, and judging from recent posts on python-dev
you are already working on the first and most important issue.

If you want to attract further suggestions on how to smoothen the logging
experience, from people who are more familiar with the package than I am,
it would probably be a good idea to open up a new thread.

Peter





More information about the Python-list mailing list