[Zope3-checkins] CVS: Zope3/lib/python/Transaction - Manager.py:1.5

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


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

Modified Files:
	Manager.py 
Log Message:
Use a logger object rather than straight calls into the logging
module.


=== Zope3/lib/python/Transaction/Manager.py 1.4 => 1.5 ===
--- Zope3/lib/python/Transaction/Manager.py:1.4	Thu Dec 19 12:54:49 2002
+++ Zope3/lib/python/Transaction/Manager.py	Thu Dec 19 17:05:29 2002
@@ -13,18 +13,18 @@
     txn_factory = Transaction
 
     def __init__(self):
-        pass
+        self.logger = logging.getLogger("txn")
 
     def new(self):
         txn = self.txn_factory(self)
-        logging.debug("txn %s: begin" % txn)
+        self.logger.debug("%s: begin", txn)
         return txn
 
     def commit(self, txn):
         assert txn._status is Status.ACTIVE
         txn._status = Status.PREPARING
         prepare_ok = True
-        logging.debug("txn %s: prepare" % txn)
+        self.logger.debug("%s: prepare", txn)
         try:
             for r in txn._resources:
                 if prepare_ok and not r.prepare(txn):
@@ -40,14 +40,14 @@
             self.abort(txn)
 
     def _commit(self, txn):
-        logging.debug("txn %s: commit" % txn)
+        self.logger.debug("%s: commit", txn)
         # finish the two-phase commit
         for r in txn._resources:
             r.commit(txn)
         txn._status = Status.COMMITTED
 
     def abort(self, txn):
-        logging.debug("txn %s: abort" % txn)
+        self.logger.debug("%s: abort", txn)
         assert txn._status in (Status.ACTIVE, Status.PREPARED, Status.FAILED)
         txn._status = Status.PREPARING
         for r in txn._resources:
@@ -55,7 +55,7 @@
         txn._status = Status.ABORTED
 
     def savepoint(self, txn):
-        logging.debug("txn %s: savepoint" % txn)
+        self.logger.debug("%s: savepoint", txn)
         return Rollback([r.savepoint(txn) for r in txn._resources])
 
 class Rollback(object):
@@ -75,6 +75,7 @@
 class ThreadedTransactionManager(TransactionManager):
 
     def __init__(self):
+        TransactionManager.__init__(self)
         self._pool = {}
 
     def new(self):