reduced log spam

This commit is contained in:
Darren Ranalli 2004-03-13 05:19:56 +00:00
parent 88e92bfbf8
commit 1099342df8
2 changed files with 24 additions and 24 deletions

View File

@ -204,7 +204,7 @@ class DistributedLevel(DistributedObject.DistributedObject,
def announceLeaving(self): def announceLeaving(self):
"""call this just before leaving the level; this may result in """call this just before leaving the level; this may result in
the factory being destroyed on the AI""" the factory being destroyed on the AI"""
DistributedLevel.notify.info('announceLeaving') DistributedLevel.notify.debug('announceLeaving')
self.doneBarrier() self.doneBarrier()
def placeLocalToon(self): def placeLocalToon(self):
@ -439,7 +439,7 @@ class DistributedLevel(DistributedObject.DistributedObject,
# listen for camera-ray/floor collision events # listen for camera-ray/floor collision events
def handleCameraRayFloorCollision(collEntry, self=self): def handleCameraRayFloorCollision(collEntry, self=self):
name = collEntry.getIntoNode().getName() name = collEntry.getIntoNode().getName()
print 'camera floor ray collided with: %s' % name self.notify.debug('camera floor ray collided with: %s' % name)
prefixLen = len(DistributedLevel.FloorCollPrefix) prefixLen = len(DistributedLevel.FloorCollPrefix)
if (name[:prefixLen] == DistributedLevel.FloorCollPrefix): if (name[:prefixLen] == DistributedLevel.FloorCollPrefix):
try: try:
@ -478,11 +478,11 @@ class DistributedLevel(DistributedObject.DistributedObject,
a zone. a zone.
See camEnterZone() See camEnterZone()
""" """
DistributedLevel.notify.info('toonEnterZone%s' % zoneNum) DistributedLevel.notify.debug('toonEnterZone%s' % zoneNum)
if zoneNum != self.lastToonZone: if zoneNum != self.lastToonZone:
self.lastToonZone = zoneNum self.lastToonZone = zoneNum
print "toon is standing in zone %s" % zoneNum self.notify.debug("toon is standing in zone %s" % zoneNum)
messenger.send("factoryZoneChanged", [zoneNum]) messenger.send("factoryZoneChanged", [zoneNum])
def camEnterZone(self, zoneNum): def camEnterZone(self, zoneNum):
@ -493,7 +493,7 @@ class DistributedLevel(DistributedObject.DistributedObject,
a zone. a zone.
See toonEnterZone() See toonEnterZone()
""" """
DistributedLevel.notify.info('camEnterZone%s' % zoneNum) DistributedLevel.notify.debug('camEnterZone%s' % zoneNum)
self.enterZone(zoneNum) self.enterZone(zoneNum)
if zoneNum != self.lastCamZone: if zoneNum != self.lastCamZone:
@ -516,13 +516,13 @@ class DistributedLevel(DistributedObject.DistributedObject,
if zoneId is not None: if zoneId is not None:
zoneNum = self.getZoneNumFromId(zoneId) zoneNum = self.getZoneNumFromId(zoneId)
self.notify.info('lockVisibility to zoneNum %s' % zoneNum) self.notify.debug('lockVisibility to zoneNum %s' % zoneNum)
self.lockVizZone = zoneNum self.lockVizZone = zoneNum
self.enterZone(self.lockVizZone) self.enterZone(self.lockVizZone)
def unlockVisibility(self): def unlockVisibility(self):
"""release the visibility lock""" """release the visibility lock"""
self.notify.info('unlockVisibility') self.notify.debug('unlockVisibility')
if not hasattr(self, 'lockVizZone'): if not hasattr(self, 'lockVizZone'):
self.notify.warning('visibility already unlocked') self.notify.warning('visibility already unlocked')
else: else:
@ -548,7 +548,7 @@ class DistributedLevel(DistributedObject.DistributedObject,
def updateVisibility(self, zoneNum=None): def updateVisibility(self, zoneNum=None):
"""update the visibility assuming that we're in the specified """update the visibility assuming that we're in the specified
zone; don't check to see if it's the zone we're already in""" zone; don't check to see if it's the zone we're already in"""
#print 'updateVisibility %s' % globalClock.getFrameCount() #self.notify.debug('updateVisibility %s' % globalClock.getFrameCount())
if zoneNum is None: if zoneNum is None:
zoneNum = self.curZoneNum zoneNum = self.curZoneNum
if zoneNum is None: if zoneNum is None:
@ -597,16 +597,16 @@ class DistributedLevel(DistributedObject.DistributedObject,
removedZoneNums.append(vz) removedZoneNums.append(vz)
if (not addedZoneNums) and (not removedZoneNums): if (not addedZoneNums) and (not removedZoneNums):
DistributedLevel.notify.info( DistributedLevel.notify.debug(
'visible zone list has not changed') 'visible zone list has not changed')
vizZonesChanged = 0 vizZonesChanged = 0
else: else:
# show the new, hide the old # show the new, hide the old
DistributedLevel.notify.info('showing zones %s' % DistributedLevel.notify.debug('showing zones %s' %
addedZoneNums) addedZoneNums)
for az in addedZoneNums: for az in addedZoneNums:
self.showZone(az) self.showZone(az)
DistributedLevel.notify.info('hiding zones %s' % DistributedLevel.notify.debug('hiding zones %s' %
removedZoneNums) removedZoneNums)
for rz in removedZoneNums: for rz in removedZoneNums:
self.hideZone(rz) self.hideZone(rz)
@ -637,7 +637,7 @@ class DistributedLevel(DistributedObject.DistributedObject,
for vz in vizList: for vz in vizList:
visibleZoneIds.append(self.getZoneId(vz)) visibleZoneIds.append(self.getZoneId(vz))
assert(uniqueElements(visibleZoneIds)) assert(uniqueElements(visibleZoneIds))
DistributedLevel.notify.info('new viz list: %s' % visibleZoneIds) DistributedLevel.notify.debug('new viz list: %s' % visibleZoneIds)
toonbase.tcr.sendSetZoneMsg(self.levelZone, visibleZoneIds) toonbase.tcr.sendSetZoneMsg(self.levelZone, visibleZoneIds)
@ -750,7 +750,7 @@ class DistributedLevel(DistributedObject.DistributedObject,
# Ouch! # Ouch!
def startOuch(self, ouchLevel, period=2): def startOuch(self, ouchLevel, period=2):
print 'startOuch %s' % ouchLevel self.notify.debug('startOuch %s' % ouchLevel)
if not hasattr(self, 'doingOuch'): if not hasattr(self, 'doingOuch'):
def doOuch(task, self=self, ouchLevel=ouchLevel, period=period): def doOuch(task, self=self, ouchLevel=ouchLevel, period=period):
self.b_setOuch(ouchLevel) self.b_setOuch(ouchLevel)

View File

@ -3,7 +3,7 @@
import string import string
import LevelConstants import LevelConstants
def getZoneNum2Node(levelModel): def getZoneNum2Node(levelModel, logFunc=lambda str:str):
""" given model, returns dict of ZoneNumber -> ZoneNode """ """ given model, returns dict of ZoneNumber -> ZoneNode """
def findNumberedNodes(baseString, model, caseInsens=1): def findNumberedNodes(baseString, model, caseInsens=1):
# finds nodes whose name follows the pattern 'baseString#blah' # finds nodes whose name follows the pattern 'baseString#blah'
@ -15,7 +15,7 @@ def getZoneNum2Node(levelModel):
num2node = {} num2node = {}
for potentialNode in potentialNodes: for potentialNode in potentialNodes:
name = potentialNode.getName() name = potentialNode.getName()
print 'potential match for %s: %s' % (baseString, name) logFunc('potential match for %s: %s' % (baseString, name))
name = name[len(baseString):] name = name[len(baseString):]
numDigits = 0 numDigits = 0
while numDigits < len(name): while numDigits < len(name):
@ -27,19 +27,19 @@ def getZoneNum2Node(levelModel):
num = int(name[:numDigits]) num = int(name[:numDigits])
# is this a valid zoneNum? # is this a valid zoneNum?
if num == LevelConstants.UberZoneEntId: if num == LevelConstants.UberZoneEntId:
print ('warning: cannot use UberZone zoneNum (%s). ' logFunc('warning: cannot use UberZone zoneNum (%s). '
'ignoring %s' % (LevelConstants.UberZoneEntId, 'ignoring %s' % (LevelConstants.UberZoneEntId,
potentialNode)) potentialNode))
continue continue
if (num < LevelConstants.MinZoneNum) or ( if (num < LevelConstants.MinZoneNum) or (
num > LevelConstants.MaxZoneNum): num > LevelConstants.MaxZoneNum):
print 'warning: zone %s is out of range. ignoring %s' % ( logFunc('warning: zone %s is out of range. ignoring %s' %
num, potentialNode) (num, potentialNode))
continue continue
# do we already have a ZoneNode for this zone num? # do we already have a ZoneNode for this zone num?
if num in num2node: if num in num2node:
print 'warning: zone %s already assigned to %s. ignoring %s' % ( logFunc('warning: zone %s already assigned to %s. ignoring %s' %
num, num2node[num], potentialNode) (num, num2node[num], potentialNode))
continue continue
num2node[num] = potentialNode num2node[num] = potentialNode