XmlWriterTraceListener.TraceEvent Method

Definition

Writes event trace information to the output file or stream.

Overloads

TraceEvent(TraceEventCache, String, TraceEventType, Int32, String)

Writes trace information, a message, and event information to the file or stream.

TraceEvent(TraceEventCache, String, TraceEventType, Int32, String, Object[])

Writes trace information, a formatted message, and event information to the file or stream.

TraceEvent(TraceEventCache, String, TraceEventType, Int32, String)

Source:
XmlWriterTraceListener.cs
Source:
XmlWriterTraceListener.cs
Source:
XmlWriterTraceListener.cs

Writes trace information, a message, and event information to the file or stream.

C#
public override void TraceEvent(System.Diagnostics.TraceEventCache? eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string? message);
C#
public override void TraceEvent(System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string message);

Parameters

eventCache
TraceEventCache

A TraceEventCache that contains the current process ID, thread ID, and stack trace information.

source
String

The source name.

eventType
TraceEventType

One of the TraceEventType values.

id
Int32

A numeric identifier for the event.

message
String

The message to write.

Remarks

The eventCache, source, eventType, and id parameters are used in the header and footer of the trace. The id parameter is converted to an unsigned integer before writing, so a negative id value is written as a large positive integer. The message parameter is written as the Message element.

Important

This method is not intended to be called directly by application code. It is called by methods of the Debug, Trace, and TraceSource classes to write trace data.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

TraceEvent(TraceEventCache, String, TraceEventType, Int32, String, Object[])

Source:
XmlWriterTraceListener.cs
Source:
XmlWriterTraceListener.cs
Source:
XmlWriterTraceListener.cs

Writes trace information, a formatted message, and event information to the file or stream.

C#
public override void TraceEvent(System.Diagnostics.TraceEventCache? eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string? format, params object?[]? args);
C#
public override void TraceEvent(System.Diagnostics.TraceEventCache? eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string format, params object?[]? args);
C#
public override void TraceEvent(System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string format, params object[] args);

Parameters

eventCache
TraceEventCache

A TraceEventCache that contains the current process ID, thread ID, and stack trace information.

source
String

The source name.

eventType
TraceEventType

One of the TraceEventType values.

id
Int32

A numeric identifier for the event.

format
String

A format string that contains zero or more format items that correspond to objects in the args array.

args
Object[]

An object array containing zero or more objects to format.

Remarks

The eventCache, source, eventType, and id parameters are used in the header and footer of the trace. The id parameter is converted to an unsigned integer before writing, so a negative id value is written as a large positive integer. The String.Format(String, Object[]) method is called, passing in the format string and args array as parameters, to format the args object array as the Message element.

Important

This method is not intended to be called directly by application code. It is called by methods of the Debug, Trace, and TraceSource classes to write trace data.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1