def setTraceLevel()

in scripts/yapl/Trace.py [0:0]


  def setTraceLevel (self,level):
    """
      Set the trace level for this instance of Trace to the given level.
    
      The given level may be a Jython string that is a valid trace level as determined
      by the _coerceLevel() method.  Or the given level may be an integer constant that 
      is one of the levels defined in the Level class.
    """
    if (type(level) == type("") or type(level) == type(u"")):
      if (level):
        level = self._coerceLevel(level)
        self.traceLevel = level
      #endIf
    elif (type(level) == type(0)):
      if (self._isTraceLevel(level)):
        self.traceLevel = level
      else:
        # level is a number but not in the range of a trace level.
        raise TraceLevelException("Invalid trace level: %s  Valid trace levels are defined by the Level class." % level)
      #endIf
    else:
      # Odd case where level is unexpected type
      raise TraceLevelException("Trace level must be either a string or an integer.  Use levels defined by the Level class.")