diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 9f252a651..b8c5a9364 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,6 +1,7 @@ 2005-08-26 Martin Hawlisch * src/plugins/TestcaseGenerator.py: Changed param handling; add more tests; make names shorter and configurable + * src/GrampsDbBase.py: Print transaction if GRAMPS_SIGNAL=1 2005-08-26 Don Allingham * src/plugins/DescendChart.py: Fix spacing and line drawing, diff --git a/gramps2/src/GrampsDbBase.py b/gramps2/src/GrampsDbBase.py index e7406ecaa..b87d88930 100644 --- a/gramps2/src/GrampsDbBase.py +++ b/gramps2/src/GrampsDbBase.py @@ -36,8 +36,11 @@ import random import locale import re import sets +import sys from gettext import gettext as _ +log = sys.stderr.write + #------------------------------------------------------------------------- # # GRAMPS libraries @@ -135,6 +138,14 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): 'media-rebuild' : None, } + + # If this is True logging will be turned on. + try: + __LOG_ALL = int(os.environ.get('GRAMPS_SIGNAL',"0")) == 1 + except: + __LOG_ALL = False + + def __init__(self): """ Creates a new GrampsDbBase instance. A new GrampDbBase class should @@ -996,12 +1007,16 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): has no effect until it is committed using the transaction_commit function of the this database object. """ + if self.__LOG_ALL: + log("%s: Transaction begin '%s'\n" % (self.__class__.__name__, str(msg))) return Transaction(msg,self.undodb) def transaction_commit(self,transaction,msg): """ Commits the transaction to the assocated UNDO database. """ + if self.__LOG_ALL: + log("%s: Transaction commit '%s'\n" % (self.__class__.__name__, str(msg))) if not len(transaction) or self.readonly: return transaction.set_description(msg)