[logging/debug] move transaction operations logs from self.debug to DBG_OPS
There were a mixing between displaying transaction operations log on
logger.debug and only when DBG_OPS was on, uniformize everything behind
DBG_OPS.
Closes #17229126
--- a/cubicweb/server/session.py Wed Aug 21 02:10:12 2019 +0200
+++ b/cubicweb/server/session.py Wed Aug 21 04:52:08 2019 +0200
@@ -674,6 +674,7 @@
def rollback(self):
"""rollback the current transaction"""
cnxset = self.cnxset
+ debug = server.DEBUG & server.DBG_OPS
assert cnxset is not None
try:
# by default, operations are executed with security turned off
@@ -686,7 +687,8 @@
self.critical('rollback error', exc_info=sys.exc_info())
continue
cnxset.rollback()
- self.debug('rollback for transaction %s done', self)
+ if debug:
+ print('rollback for transaction %s done' % self)
finally:
self.clear()
@@ -726,7 +728,8 @@
print(operation)
operation.handle_event('precommit_event')
self.pending_operations[:] = processed
- self.debug('precommit transaction %s done', self)
+ if debug:
+ print('precommit transaction %s done' % self)
except BaseException:
# if error on [pre]commit:
#
@@ -772,7 +775,8 @@
raise
self.critical('error while postcommit',
exc_info=sys.exc_info())
- self.debug('postcommit transaction %s done', self)
+ if debug:
+ print('postcommit transaction %s done' % self)
return self.transaction_uuid(set=False)
finally:
self.clear()