BOOL TRACEF(flag, level)
int flag;
int level;
TRACE(flag, level, (printf arguments));
void traceset(tracestring)
char *tracestring;
The TRACEF macro tests whether the specified flag is set to at least the indicated level. For example:
if (TRACEF(24, 3))
tests flag 24; if it is set to 3 or higher, the if statement succeeds.
The TRACE macro incorporates a printf(3) statement. For example, the code:
TRACE(24, 3, ("xyzzy = %d, xyzzy));
Prints the ``xyzzy'' variable when trace flag 24 is set to level 3 or higher. The extra set of parentheses is important.
Flags can be adjusted using the traceset routine. This parses the trace string, setting indicated flags as it goes. The string is a comma-separated list of trace settings. Each setting has the syntax:
flag[-flag][.level]
If the level is omitted, one is assumed. If only one flag is indicated, it is set individually. If a range of flags is given, all flags inclusively between the two values are set. For example:
20-29.2
sets the ten flags numbered between 20 and 29 to level 2.
Flag names can be symbolic. Symbolic names are looked up in the file ``<searchpath>/lib/traceflags'', where <searchpath> is the default search path used by openpath(3). This file is a series of lines, each containing a flag name, white space, and the flag value. Blank lines and lines beginning with `#' are ignored. Case is ignored in flag names.