Package qm :: Module trace :: Class Tracer
[hide private]
[frames] | no frames]

Class Tracer

source code

A 'Tracer' outputs trace messages useful for debugging.

Instance Methods [hide private]
 
__init__(self, file=sys.stdout)
Construct a new 'Tracer'.
source code
 
Write(self, message, category, level=0)
Output a trace message.
source code
 
GetThreshold(self, category)
Return the current threshold for 'category'.
source code
 
SetThreshold(self, category, level)
Set the threshold associated with 'category'.
source code
Class Variables [hide private]
  prefix = 'QM_THRESHOLD_'
The prefix for an environment variable that indicates a threshold for a particular trace category.
Method Details [hide private]

__init__(self, file=sys.stdout)
(Constructor)

source code 

Construct a new 'Tracer'.

'file' -- The file object to which output should be written.

Write(self, message, category, level=0)

source code 

Output a trace message.

'message' -- A string giving the contents of the message. The message should begin with a capital letter and end with a period.

'category' -- A string indicating the category to which this message belongs.

'level' -- A non-negative integer indicating the level at which the message should be output.

Every category has an associated threshold. If the level of the 'message' is less than the threshold, the mesage will be output.

GetThreshold(self, category)

source code 

Return the current threshold for 'category'.

'category' -- A string giving a trace category.

returns -- The threshold associated with 'category'. If no threshold has been set, the threshold is considered to be zero.

SetThreshold(self, category, level)

source code 

Set the threshold associated with 'category'.

'category' --A string giving a trace category.

'level' -- A non-negative integer indicating the threshold level for 'category'.


Class Variable Details [hide private]

prefix

The prefix for an environment variable that indicates a threshold for a particular trace category. The string following the prefix gives the name of the trace category. If the environment variable has no associated level, the associated level is one. Otherwise, the associated level is given by the value of the environment variable.

Value:
'QM_THRESHOLD_'