[py-dev] Re: [py-svn] r13515 - in py/dist/py: . log log/testing

Grig Gheorghiu grig at gheorghiu.net
Fri Jun 17 16:37:25 CEST 2005


--- hpk at codespeak.net wrote:

> Author: hpk
> Date: Fri Jun 17 07:44:36 2005
> New Revision: 13515
> 
> Modified:
>    py/dist/py/__init__.py
>    py/dist/py/log/consumer.py
>    py/dist/py/log/producer.py
>    py/dist/py/log/testing/test_log.py
> Log:
> issue3 in-progress
> 
> refactored logging API 
> 
> - no severity levels offered by default anymore 
> 
> - no logging module used at the moment 
> 
> - simplified API 
> 
> - there now is a 'py.log.default' defaultlogger
> 
> 

Hi, Holger

I've looked at the refactored version of the log functionality and for
some reason it doesn't seem as intuitive to use as the old one. Now, as
an end user, you need to know the distinction between a 'producer' and
a 'consumer', which might be hard to grasp, at least at first sight.
You also need to use the Producer class directly, as it is not hidden
anymore. My preference would be to hide names such as producers and
consumers and expose more user-friendly names such as logs and loggers.

Other than that, I like the fact that the keyword-based matching offers
a lot of flexibility. I can do for example:

py.log.db = py.log.Producer('db')
py.log.setconsumer('db', function_to_insert_in_db)
py.log.db("hello world")

Have you have any use for multiple keywords? Just curious, as I haven't
seen the need for it yet.

About severity levels: I guess in the current version you can just set
the consumer for that particular keyword to None in a configuration
file, and that would disable logging for that keyword. That's how you
would turn on and off debugging messages for example, am I right?

Grig



More information about the py-dev mailing list