# Generating trace records

In the service implementation functions, the local and global tracemasks are checked to see what trace record categories are active. For active trace record categories, invoke dispLogTrace with the following arguments to generate and log a trace record:

- A context handle.

- The service ID.

- A traceseverity flag indicating whether this is a warning, an error, or an informational trace record. The acceptable values are:

- CTA_TRACE_SEVERITY_INFO

- CTA_TRACE_SEVERITY_WARNING

- CTA_TRACE_SEVERITY_ERROR

- The tracetag.

- A buffer containing trace data. The trace data can be anything that is useful to be presented to a developer during a debug session. The trace data can be in binary or ASCII; there are no restrictions. It is up to xxxFormatTraceBuffer to convert this portion of the trace record to human readable (ASCII) format.

- The size of the buffer.

To determine whether or not to invoke dispLogTrace, check both the global and local tracemasks to see if the appropriate category is set. If so, invoke dispLogTrace.

tik service

One of the things being traced is the set of commands being sent from the tik service to the tik server (when the tracemask has the CTA_TRACEMASK_DRIVER_COMMANDS category set).

<<<< excerpt from tikcomms.c >>>>

/*--------------------------------------------------------------
Utility function to send a command via IPC synchronously.
A Natural Access error code is returned to indicate success
status.
-------------------------------------------------------------*/
DWORD tikSendClientCommand( TIK_CHANNEL_OBJECT *ptikChannel,
TIK_CMD_COM_OBJ *cmd )
{
int cnt;
DWORD ret;
TSIIPC_COMMAND_STATUS status = {0};
if ( cmd == NULL || ptikChannel == NULL )
{
return CTAERR_BAD_ARGUMENT;
}
/* Log trace if requested. Both the global tracemask must be
checked as well as the local, per mgrcontext, tracemask.*/
if ( *tikTracePointer & CTA_TRACEMASK_DRIVER_COMMANDS ||
ptikChannel->tracemask & CTA_TRACEMASK_DRIVER_COMMANDS )
{
if( (ret=dispLogTrace( ptikChannel->ctahd,
TIK_SVCID,
CTA_TRACE_SEVERITY_INFO,
TIK_TRACETAG_CMD,
(void *)cmd,
sizeof(TIK_CMD_COM_OBJ) )) != SUCCESS )
{
return ret;
}
}
...
}