[Zope3-checkins] CVS: Zope3/lib/python/ZODB - Connection.py:1.93

Guido van Rossum guido@python.org
Thu, 19 Dec 2002 17:00:13 -0500


Update of /cvs-repository/Zope3/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv7145

Modified Files:
	Connection.py 
Log Message:
Convert to logging module.


=== Zope3/lib/python/ZODB/Connection.py 1.92 => 1.93 ===
--- Zope3/lib/python/ZODB/Connection.py:1.92	Fri Dec 13 17:13:48 2002
+++ Zope3/lib/python/ZODB/Connection.py	Thu Dec 19 17:00:13 2002
@@ -55,7 +55,6 @@
 from Transaction import get_transaction
 from Persistence.Cache import Cache
 from Persistence.IPersistentDataManager import IPersistentDataManager
-from zLOG import LOG, ERROR, BLATHER, INFO, DEBUG
 
 import cPickle
 from cStringIO import StringIO
@@ -63,6 +62,7 @@
 import threading
 import time
 from types import StringType, ClassType, TupleType
+import logging
 
 class Connection(ExportImport.ExportImport):
     """Object managers for individual object space.
@@ -94,6 +94,7 @@
         self._version = version
         self._cache = cache = Cache(cache_size)
         self._reader = ConnectionObjectReader(self, self._cache)
+        self._logger = logging.getLogger("ZODB")
 
         # _invalidated queues invalidate messages delivered from the DB
         # _inv_lock prevents one thread from modifying the set while
@@ -193,8 +194,7 @@
         except ConflictError:
             raise
         except:
-            LOG('ZODB', ERROR, "Couldn't load state for %s" % `oid`,
-                error=sys.exc_info())
+            self._logger.exception("Couldn't load state for %r", oid)
             raise
         else:
             # Add the object to the cache active list
@@ -252,8 +252,8 @@
                     f()
                 except:
                     f_self = getattr(f, 'im_self', f)
-                    LOG('ZODB',ERROR, 'Close callback failed for %s' % f_self,
-                        error=sys.exc_info())
+                    self._logger.exception("Close callback failed for %s",
+                                           f_self)
             self.__onCloseCallbacks = None
 
     # some cache-related methods
@@ -290,7 +290,7 @@
 
     def objcommit(self, object, transaction):
         oid = object._p_oid
-        LOG("ZODB", DEBUG, "commit object %s" % u64(oid))
+        self._logger.debug("commit object %s", u64(oid))
         
         if oid is None or object._p_jar is not self:
             oid = self.new_oid()