"changed order of prefix, added documentation to report"

This commit is contained in:
Josh Wilson 2007-04-12 19:18:46 +00:00
parent 9ada65e1d4
commit 71235ae279

View File

@ -2526,27 +2526,30 @@ def report(types = [], prefix = '', notifyFunc = None, dConfigParam = []):
types : A subset list of ['timeStamp', 'frameCount', 'avLocation'] types : A subset list of ['timeStamp', 'frameCount', 'avLocation']
This allows you to specify certain common bits of info. This allows you to specify certain common bits of info.
args: Prints the arguments as they were passed to this args: Prints the arguments as they were passed to
function. this function.
timeStamp: Adds the current frame time to the output. timeStamp: Adds the current frame time to the output.
deltaStamp: Adds the current AI synched frame time to
the output
frameCount: Adds the current frame count to the output. frameCount: Adds the current frame count to the output.
Usually cleaner than the timeStamp output. Usually cleaner than the timeStamp output.
avLocation: Adds the localAvatar's network location avLocation: Adds the localAvatar's network location
to the output. Useful for interest debugging. to the output. Useful for interest debugging.
interests: Prints the current interest state after the
report.
stackTrace: Prints a stack trace after the report.
prefix: Optional string to prepend to output, just before the function. prefix: Optional string to prepend to output, just before the function.
Allows for easy grepping. Allows for easy grepping and is useful when merging AI/Client
reports into a single file.
notifyFunc: A notify function such as info, debug, warning, etc. notifyFunc: A notify function such as info, debug, warning, etc.
By default the report will be printed to stdout. This By default the report will be printed to stdout. This
will allow you send the report to a designated 'notify' will allow you send the report to a designated 'notify'
output. output.
dConfigParam: A list of Config.prc string variables. dConfigParam: A list of Config.prc string variables.
By default the report will always print. If you By default the report will always print. If you
specify this param, it will only print if one of the specify this param, it will only print if one of the
specified config strings resolve to True. specified config strings resolve to True.
""" """
def decorator(f): def decorator(f):
return f return f
@ -2574,8 +2577,12 @@ def report(types = [], prefix = '', notifyFunc = None, dConfigParam = []):
else: else:
rArgs = '(' + reduce(str.__add__,rArgs)[:-2] + ')' rArgs = '(' + reduce(str.__add__,rArgs)[:-2] + ')'
outStr = '%s%s' % (f.func_name, rArgs) outStr = '%s%s' % (f.func_name, rArgs)
if prefix:
outStr = '%s %s' % (prefix, outStr)
preStr = '' preStr = ''
if 'frameCount' in types: if 'frameCount' in types:
@ -2590,8 +2597,6 @@ def report(types = [], prefix = '', notifyFunc = None, dConfigParam = []):
if 'avLocation' in types: if 'avLocation' in types:
outStr = '%s : %s' % (outStr, str(localAvatar.getLocation())) outStr = '%s : %s' % (outStr, str(localAvatar.getLocation()))
if prefix:
outStr = '%s %s' % (prefix, outStr)
# determine whether we should print # determine whether we should print
doPrint = False doPrint = False
@ -2613,7 +2618,7 @@ def report(types = [], prefix = '', notifyFunc = None, dConfigParam = []):
else: else:
print outStr print outStr
if 'printInterests' in types: if 'interests' in types:
base.cr.printInterestSets() base.cr.printInterestSets()
if 'stackTrace' in types: if 'stackTrace' in types: