TraceListener.TraceData Method

Definition

Writes trace data to the listener specific output.

Overloads

TraceData(TraceEventCache, String, TraceEventType, Int32, Object)

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

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

Writes trace information, an array of data objects and event information to the listener specific output.

TraceData(TraceEventCache, String, TraceEventType, Int32, Object)

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

public:
 virtual void TraceData(System::Diagnostics::TraceEventCache ^ eventCache, System::String ^ source, System::Diagnostics::TraceEventType eventType, int id, System::Object ^ data);
public virtual void TraceData (System.Diagnostics.TraceEventCache? eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, object? data);
public virtual void TraceData (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, object data);
[System.Runtime.InteropServices.ComVisible(false)]
public virtual void TraceData (System.Diagnostics.TraceEventCache eventCache, string source, System.Diagnostics.TraceEventType eventType, int id, object data);
abstract member TraceData : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * obj -> unit
override this.TraceData : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * obj -> unit
[<System.Runtime.InteropServices.ComVisible(false)>]
abstract member TraceData : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * obj -> unit
override this.TraceData : System.Diagnostics.TraceEventCache * string * System.Diagnostics.TraceEventType * int * obj -> unit
Public Overridable Sub TraceData (eventCache As TraceEventCache, source As String, eventType As TraceEventType, id As Integer, data 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.

data
Object

The trace data to emit.

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 eventCache, source, eventType and id parameters in the header and footer of the trace. The data parameter is written as the body of the trace message. The ToString method of the data object is used to convert the object to a String.

See also

Applies to

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

Writes trace information, an array of data objects and event information to the listener specific output.

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

data
Object[]

An array of objects to emit as data.

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 data objects are converted to strings using the ToString method of each object. 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