trace_write—write a text message to a trace module
trace_write($MODID,$LEVEL,$TEXT)
trace_write arguments
Argument | Mode | Type | Description |
---|---|---|---|
| Input | STRING | Specifies the module identifier |
| Input | STRING | Specifies the message level:
|
The level can be indicated with the full name of the level or with only the first letter.
| Input | STRING | Specifies the message text that you want to write to the trace |
Use the trace_write
to write the textual message $TEXT
in the trace module specified by identifier $MODID
at level $LEVEL
.
Note
If $MODID
is not a valid module identifier, the text will not be included in the trace. No error message will be generated.
trace_write example - Registration of user trace module and writing a message on trace
RECORD TRACE
DEFINES {
modid : INTEGER;
}
END
new test_trace_register : MC_CELL_START
triggers
{
$TRACE.modid = trace_register(USER01);
}
END
new test_trace_write : EVENT($E) where [$E.mc_tool==trace]
triggers
{
trace_write($TRACE.modid,INFORM,sprintf('Event #%u: %s',[$E.event_handle,$E.mc_tool_id]));
}
END
To register a user defined module, record TRACE
is defined to store the module identifier in the modid
slot, and a rule is triggered on the MC_CELL_START
event to register the module when the cell starts.
Incoming events with mc_tool
set to trace will write a text message in the trace that includes the event_handle
and mc_tool_id
slots of the event.
An event such as the following,
mposter -n mcdev -a EVENT -b 'mc_tool=trace;mc_tool_id="message for trace"'
causes a message to be included in the trace in module USER01
, as shown:
20100217 182410.908822 mcell: USER01: Event #2447: message for trace
Comments
Log in or register to comment.