in scripts/yapl/Trace.py [0:0]
def __init__(self,entity,level=Level.INFO):
"""
The Trace class has two instance variables that get initialized in the
constructor:
entityName - (required) the name of the module or class being traced
traceLevel - (optional) gets set to Level.INFO if optional keyword "level"
parameter is not set on the Trace instantiation.
The level parameter must be an integer that is one of the
constants in the Level class.
"""
if (not entity):
raise EntityNameException("A module or class name is required when instantiating a Trace instance.")
#endIf
if (type(level) != type(0) or level < Level.NONE or level > Level.FINEST):
raise TraceLevelException("Invalid trace level: %s. Trace level must be an integer constant as defined by the Level class." % level)
#endIf
self.traceLevel = level
# Register this trace instance
Trace.tracedEntities[entity] = self
self.entityName = entity
# If the traceSpec has been set, check the traceSpec and configure this trace instance
# trace level based on the traceSpec if there is a match on this Trace instance entity name.
if (Trace.traceSpec):
self.configureThisTrace()