New submission from Olaf Conradi <[EMAIL PROTECTED]>:

When using commit veto it is useful to know when a transaction gets committed or
not.
This patch adds logging on debug level for commit() and abort()

----------
files: repoze_tm2_logging.patch
messages: 115
nosy: olaf
priority: wish
status: in-progress
title: Logging for repoze.tm2
topic: repoze.tm

__________________________________
Repoze Bugs <[EMAIL PROTECTED]>
<http://bugs.repoze.org/issue43>
__________________________________
Index: repoze/tm/__init__.py
===================================================================
--- repoze/tm/__init__.py	(revision 1611)
+++ repoze/tm/__init__.py	(working copy)
@@ -1,8 +1,11 @@
 # repoze TransactionManager WSGI middleware
 import transaction
+import logging
 
 ekey = 'repoze.tm.active'
 
+log = logging.getLogger(__name__)
+
 class TM:
     def __init__(self, application, commit_veto=None):
         self.application = application
@@ -41,11 +44,13 @@
         t = transaction.get()
         t.commit()
         after_end.cleanup(t)
+        log.debug('Committed transaction')
 
     def abort(self):
         t = transaction.get()
         t.abort()
         after_end.cleanup(t)
+        log.debug('Aborted transaction')
 
 def isActive(environ):
     if ekey in environ:
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to