[DB-SIG] Extending DB-API

M.-A. Lemburg mal at egenix.com
Tue Nov 21 21:41:55 CET 2006


Mario Frasca wrote:
> On 2006-1121 16:23:26, M.-A. Lemburg wrote:
>> Mario Frasca wrote:
>>> [...] it would be nice (I mean, I think it would) 
>>> if also the logging policy would be stated in the db-api2++
>> I'm not really sure what logging has to do with the DB-API.
>>
>> Could you explain ?
> 
> I can try...
> 
> as I see it, logging has to do with every module, so since there is a
> standard logging module, my feeling is that there could be also a
> standard logging policy...
> 
> a client (a program) using modules could take advance of the fact that
> modules log in a standardized way all kind of information... (once they do
> so, I mean) the program would then decide whether to handle the messages
> or not.  [[ about performance: according to the documentation of the
> logging module, a logging call to a logger set to a higher logging level
> (a DEBUG message to a logger set to CRITICAL) is discarded immediately
> after a level comparison ]]
> 
> so if I want to know what a (db-api2) module is doing (and possibly how),
> I would do this:
> 
> import logging
> import MySQLdb
> logging.getLogger('MySQLdb').setLevel(logging.INFO)
> 
> well, since the above would not cause errors even if the module does not
> define the logger (but it also would not have any effect), we could maybe
> agree that *if* the module developers want to provide logging information,
> they should do so using the logging module and calling the module root
> logger as the name of the module...  and that per default its level should
> be set to CRITICAL (or ERROR)...  and then state at which level to log
> some of the more relevant information, leaving lower logging levels free
> to the developers...  I know that this may sound too strict for many,
> but after all it would serve to save a lot of time to many more...

Whether or not module authors use the logging module should
really be up to them and not be required by the DB-API.

Note that many database modules are written as C extensions
and this makes it hard for them to use the logging module
as there is no C API for it which could be used, AFAIK.

> what about the wiki space?  is there any already available?

There's a page in the wiki already:

    http://wiki.python.org/moin/DbApi3

It lists some of the things that were discussed on this mailing
list.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Nov 21 2006)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::


More information about the DB-SIG mailing list