TraceListener.TraceEvent Method

Definition

Writes trace and event information to the listener specific output.

Overloads

TraceEvent(TraceEventCache, String, TraceEventType, Int32)

Writes trace and event information to the listener specific output.

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

Writes trace information, a message, and event information to the listener specific output.

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

Writes trace information, a formatted array of objects and event information to the listener specific output.

TraceEvent(TraceEventCache, String, TraceEventType, Int32)

Writes trace and event information to the listener specific output.

public:
 virtual void TraceEvent(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, System::Diagnostics::TraceEventType eventType, int id);
public virtual void TraceEvent (System.Diagnostics.TraceEventCache? eventCache, string source, System.Diagnostics.TraceEventType eventType, int id);
public virtual void TraceEvent (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual void TraceEvent (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id);
abstract member TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int -> unit
override this.TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int -> unit
override this.TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int -> unit
Public Overridable Sub TraceEvent (eventCache As TraceEventCache, source As String, eventType As TraceEventType, id As Integer)

Parameters

eventCache
TraceEventCache

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

source
String

A name used to identify the output, typically the name of the application that generated the trace event.

eventType
TraceEventType

One of the TraceEventType values specifying the type of event that has caused the trace.

id
Int32

A numeric identifier for the event.

Attributes

Remarks

Important

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

The default implementation writes the values of the source, eventType and id parameters as a header. The eventCache data is written as a footer, the nature of the output data being dependent on the value of the TraceOutputOptions property.

See also

Applies to

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

Writes trace information, a message, and event information to the listener specific output.

public:
 virtual void TraceEvent(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, System::Diagnostics::TraceEventType eventType, int id, System::String ^ message);
public virtual void TraceEvent (System.Diagnostics.TraceEventCache? eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string? message);
public virtual void TraceEvent (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string message);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual void TraceEvent (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string message);
abstract member TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * string -> unit
override this.TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * string -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * string -> unit
override this.TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * string -> unit
Public Overridable Sub TraceEvent (eventCache As TraceEventCache, source As String, eventType As TraceEventType, id As Integer, message As String)

Parameters

eventCache
TraceEventCache

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

source
String

A name used to identify the output, typically the name of the application that generated the trace event.

eventType
TraceEventType

One of the TraceEventType values specifying the type of event that has caused the trace.

id
Int32

A numeric identifier for the event.

message
String

A message to write.

Attributes

Remarks

Important

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

The default implementation writes the values of the source, eventType and id parameters as a header, followed by the message data. The eventCache data is written as a footer, the nature of the output data being dependent on the value of the TraceOutputOptions property.

See also

Applies to

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

Writes trace information, a formatted array of objects and event information to the listener specific output.

public:
 virtual void TraceEvent(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, System::Diagnostics::TraceEventType eventType, int id, System::String ^ format, ... cli::array <System::Object ^> ^ args);
public virtual void TraceEvent (System.Diagnostics.TraceEventCache? eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string format, params object?[]? args);
public virtual void TraceEvent (System.Diagnostics.TraceEventCache? eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string? format, params object?[]? args);
public virtual void TraceEvent (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string format, params object[] args);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual void TraceEvent (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, string format, params object[] args);
abstract member TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * string * obj[] -> unit
override this.TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * string * obj[] -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * string * obj[] -> unit
override this.TraceEvent : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * string * obj[] -> unit
Public Overridable Sub TraceEvent (eventCache As TraceEventCache, source As String, eventType As TraceEventType, id As Integer, format As String, ParamArray args As Object())

Parameters

eventCache
TraceEventCache

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

source
String

A name used to identify the output, typically the name of the application that generated the trace event.

eventType
TraceEventType

One of the TraceEventType values specifying the type of event that has caused the trace.

id
Int32

A numeric identifier for the event.

format
String

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

args
Object[]

An object array containing zero or more objects to format.

Attributes

Remarks

Important

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

The default implementation writes the values of the source, eventType and id parameters as a header. The args object array is converted to a string using the Format method, passing the format string and args array to format the string as the message portion of the trace. The eventCache data is written as a footer, the nature of the output data being dependent on the value of the TraceOutputOptions property.

See also

Applies to