mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Logging patch from Charlie.
This commit is contained in:
parent
be9822801f
commit
38cf5f4520
|
@ -1,3 +1,9 @@
|
||||||
|
2006-09-01 Federico Di Gregorio <fog@initd.org>
|
||||||
|
|
||||||
|
* 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 <fog@initd.org>
|
2006-08-02 Federico Di Gregorio <fog@initd.org>
|
||||||
|
|
||||||
* Release 2.0.4.
|
* Release 2.0.4.
|
||||||
|
|
16
lib/pool.py
16
lib/pool.py
|
@ -19,11 +19,27 @@ This module implements thread-safe (and not) connection pools.
|
||||||
import psycopg2
|
import psycopg2
|
||||||
|
|
||||||
try:
|
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
|
from zLOG import LOG, DEBUG, INFO
|
||||||
def dbg(*args):
|
def dbg(*args):
|
||||||
LOG('ZPsycopgDA', DEBUG, "",
|
LOG('ZPsycopgDA', DEBUG, "",
|
||||||
' '.join([str(x) for x in args])+'\n')
|
' '.join([str(x) for x in args])+'\n')
|
||||||
LOG('ZPsycopgDA', INFO, "Installed", "Logging using Zope's zLOG\n")
|
LOG('ZPsycopgDA', INFO, "Installed", "Logging using Zope's zLOG\n")
|
||||||
|
|
||||||
except:
|
except:
|
||||||
import sys
|
import sys
|
||||||
def dbg(*args):
|
def dbg(*args):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user