Logs a trace record.
DWORD ctaLogTrace ( CTAHD ctahd, CTA_TRACE_SEVERITY traceseverity, unsigned tracetag, void *tracevalue, unsigned tracesize)
Argument |
Description |
ctahd |
Handle returned by ctaCreateContext. Use CTA_NULL_CTAHD if the trace message is not associated with a context. |
traceseverity |
Type of trace message. Valid values are: CTA_TRACE_SEVERITY_INFO CTA_TRACE_SEVERITY_WARNING CTA_TRACE_SEVERITY_ERROR |
tracetag |
Type of parameter passed by reference in tracevalue. Valid values are: CTA_TRACETAG_API_EVENT CTA_TRACETAG_DWORD CTA_TRACETAG_INT32 CTA_TRACETAG_STRING CTA_TRACETAG_ERROR |
tracevalue |
Pointer to a location containing the byte values to be written to the log file. |
tracesize |
Size of tracevalue in bytes. |
Return value |
Description |
SUCCESS |
|
CTAERR_INVALID_CTAHD |
An invalid context handle was passed as an argument to a function, or the context was destroyed by another thread. |
CTAERR_OUT_OF_MEMORY |
Tracing is enabled and there is not enough memory for the trace messages. |
CTAERR_NOT_INITIALIZED |
Natural Access is not initialized. Call ctaInitialize first. |
CTAERR_SVR_COMM |
Server communication error. |
ctaLogTrace logs errors, warnings, or informational messages to the Natural Access trace buffer maintained by the Natural Access Server (ctdaemon). Enable tracing by setting traceflags to CTA_TRACE_ENABLE in ctaInitialize.
ctdaemon allows viewing trace messages and logging to a file. ctdaemon translates trace records received from applications into a readable format based on the tracetag passed to this function.
Refer to Error tracing for more information.
void DemoLogString(CTAHD ctahd, char *string)
{
ctaLogTrace(ctahd,
CTA_TRACE_SEVERITY_INFO,
CTA_TRACETAG_STRING,
string, strlen(string) + 1);
}
void DemoLogAppEvent(CTA_EVENT *event)
{
ctaLogTrace(event->ctahd,
CTA_TRACE_SEVERITY_INFO,
CTA_TRACETAG_API_EVENT,
event, sizeof(*event));
}