diff --git a/ChangeLog b/ChangeLog index 30403285..fb1e8a37 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-09-01 Federico Di Gregorio + + * lib/pool.py: applied logging patch from Charlie Clark. + It will probably get a makeup and be moved to the top-level + module later. + 2006-08-02 Federico Di Gregorio * Release 2.0.4. diff --git a/lib/pool.py b/lib/pool.py index b51d2555..0468db6d 100644 --- a/lib/pool.py +++ b/lib/pool.py @@ -19,11 +19,27 @@ This module implements thread-safe (and not) connection pools. import psycopg2 try: + import logging + # do basic initialization if the module is not already initialized + logging.basicConfig(level=logging.INFO, + format='%(asctime)s %(levelname)s %(message)s') + # create logger object for psycopg2 module and sub-modules + _logger = logging.getLogger("psycopg2") + def dbg(*args): + _logger.debug("psycopg2", ' '.join([str(x) for x in args])) + try: + import App # does this make sure that we're running in Zope? + _logger.info("installed. Logging using Python logging module") + except: + _logger.debug("installed. Logging using Python logging module") + +except ImportError: from zLOG import LOG, DEBUG, INFO def dbg(*args): LOG('ZPsycopgDA', DEBUG, "", ' '.join([str(x) for x in args])+'\n') LOG('ZPsycopgDA', INFO, "Installed", "Logging using Zope's zLOG\n") + except: import sys def dbg(*args):