TraceLoggingWrite macro

Emits an event.

Syntax

void TraceLoggingWrite(
   hProvider,
   eventName,
   __VA_ARGS__
);

Parameters

hProvider

A provider registration handle.

eventName

The name of the event. This must be a string literal and not a variable. It cannot have any embedded nul characters values.

__VA_ARGS__

Return Value

None

Remarks

You might get an error that a line is too long or the compiler is out of heap space when you submit optional parameters. This may occur because a line of code is longer than the maximum length allowed by the compiler. In this case, the parameters are too complex and you need to remove some from the macro to get it to work.

The maximum number of event data descriptors is 128. Since each parameter can have 0, 1, or 2, it is possible to hit the data descriptor limit before the argument limit. In addition, the maximum number of bytes per event is 65536, which includes headers, so actual maximum number may be less than this.

Examples

TraceLoggingWrite(
	g_hMyProvider,
	"MyEventName",
	TraceLoggingString(szValue1, "MyValue1"), // Field name MyValue1
	TraceLoggingInt32(value2, "MyValue2")); // Field name MyValue2

Requirements

   
Minimum supported client Windows Vista
Minimum supported server Windows Server 2012 R2
Target Platform Windows
Header traceloggingprovider.h