Bladeren bron

print debug if verboseRepository

Darren Ranalli 19 jaren geleden
bovenliggende
commit
0ad3bac423
1 gewijzigde bestanden met toevoegingen van 14 en 11 verwijderingen
  1. 14 11
      direct/src/distributed/DoInterestManager.py

+ 14 - 11
direct/src/distributed/DoInterestManager.py

@@ -113,6 +113,9 @@ class DoInterestManager(DirectObject.DirectObject):
         self._completeEventCount = ScratchPad(num=0)
         self._completeEventCount = ScratchPad(num=0)
         self._allInterestsCompleteCallbacks = []
         self._allInterestsCompleteCallbacks = []
 
 
+    def __verbose(self):
+        return self.InterestDebug or self.getVerbose()
+
     def _getAnonymousEvent(self, desc):
     def _getAnonymousEvent(self, desc):
         return 'anonymous-%s-%s' % (desc, DoInterestManager._SerialGen.next())
         return 'anonymous-%s-%s' % (desc, DoInterestManager._SerialGen.next())
 
 
@@ -181,8 +184,8 @@ class DoInterestManager(DirectObject.DirectObject):
                 event = self._getAnonymousEvent('addInterest')
                 event = self._getAnonymousEvent('addInterest')
         DoInterestManager._interests[handle] = InterestState(
         DoInterestManager._interests[handle] = InterestState(
             description, InterestState.StateActive, scopeId, event, parentId, zoneIdList, self._completeEventCount)
             description, InterestState.StateActive, scopeId, event, parentId, zoneIdList, self._completeEventCount)
-        if self.InterestDebug:
-            print 'INTEREST DEBUG: addInterest(): handle=%s, parent=%s, zoneIds=%s, description=%s, event=%s, auto=%s' % (
+        if self.__verbose():
+            print 'CR::INTEREST.addInterest(handle=%s, parentId=%s, zoneIdList=%s, description=%s, event=%s, auto=%s)' % (
                 handle, parentId, zoneIdList, description, event, auto)
                 handle, parentId, zoneIdList, description, event, auto)
         if not auto:
         if not auto:
             self._sendAddInterest(handle, scopeId, parentId, zoneIdList, description)
             self._sendAddInterest(handle, scopeId, parentId, zoneIdList, description)
@@ -234,9 +237,9 @@ class DoInterestManager(DirectObject.DirectObject):
                     self._sendRemoveInterest(handle, scopeId)
                     self._sendRemoveInterest(handle, scopeId)
                     if event is None:
                     if event is None:
                         self._considerRemoveInterest(handle)
                         self._considerRemoveInterest(handle)
-                if self.InterestDebug:
-                    print 'INTEREST DEBUG: removeInterest(): handle=%s, event=%s' % (
-                        handle, event)
+                if self.__verbose():
+                    print 'CR::INTEREST.removeInterest(handle=%s, event=%s, auto=%s)' % (
+                        handle, event, auto)
         else:
         else:
             DoInterestManager.notify.warning(
             DoInterestManager.notify.warning(
                 "removeInterest: handle not found: %s" % (handle))
                 "removeInterest: handle not found: %s" % (handle))
@@ -279,8 +282,8 @@ class DoInterestManager(DirectObject.DirectObject):
             DoInterestManager._interests[handle].zoneIdList = zoneIdList
             DoInterestManager._interests[handle].zoneIdList = zoneIdList
             DoInterestManager._interests[handle].addEvent(event)
             DoInterestManager._interests[handle].addEvent(event)
 
 
-            if self.InterestDebug:
-                print 'INTEREST DEBUG: alterInterest(): handle=%s, parent=%s, zoneIds=%s, description=%s, event=%s' % (
+            if self.__verbose():
+                print 'CR::INTEREST.alterInterest(handle=%s, parentId=%s, zoneIdList=%s, description=%s, event=%s)' % (
                     handle, parentId, zoneIdList, description, event)
                     handle, parentId, zoneIdList, description, event)
             self._sendAddInterest(handle, scopeId, parentId, zoneIdList, description, action='modify')
             self._sendAddInterest(handle, scopeId, parentId, zoneIdList, description, action='modify')
             exists = True
             exists = True
@@ -470,8 +473,8 @@ class DoInterestManager(DirectObject.DirectObject):
         assert DoInterestManager.notify.debugCall()
         assert DoInterestManager.notify.debugCall()
         handle = di.getUint16()
         handle = di.getUint16()
         scopeId = di.getUint32()
         scopeId = di.getUint32()
-        if self.InterestDebug:
-            print 'INTEREST DEBUG: interestDone(): handle=%s' % handle
+        if self.__verbose():
+            print 'CR::INTEREST.interestDone(handle=%s)' % handle
         DoInterestManager.notify.debug(
         DoInterestManager.notify.debug(
             "handleInterestDoneMessage--> Received handle %s, scope %s" % (
             "handleInterestDoneMessage--> Received handle %s, scope %s" % (
             handle, scopeId))
             handle, scopeId))
@@ -507,10 +510,10 @@ class DoInterestManager(DirectObject.DirectObject):
                     callback()
                     callback()
                 self._allInterestsCompleteCallbacks = []
                 self._allInterestsCompleteCallbacks = []
             self.cleanupWaitAllInterestsClosed()
             self.cleanupWaitAllInterestsClosed()
-            self._completeDelayedCallback = FrameDelayedCallback(
+            self._completeDelayedCallback = FrameDelayedCall(
                 'waitForAllInterestCompletes',
                 'waitForAllInterestCompletes',
-                frames=3,
                 callback=sendEvent,
                 callback=sendEvent,
+                frames=3,
                 cancelFunc=checkMoreInterests)
                 cancelFunc=checkMoreInterests)
             checkMoreInterests = None
             checkMoreInterests = None
             sendEvent = None
             sendEvent = None