TraceListener.TraceData 方法

定义

向特定于侦听器的输出中写入跟踪数据。Writes trace data 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.

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)

参数

eventCache
TraceEventCache

包含当前进程 ID、线程 ID 以及堆栈跟踪信息的 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

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.

属性

注解

重要

此方法不应由应用程序代码直接调用,而是由、和类的成员直接调用 Debug Trace 以将 TraceSource 跟踪数据写入输出。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.

默认实现 eventCache source eventType id 在跟踪的标头和脚注中写入、和参数。The default implementation writes the eventCache, source, eventType and id parameters in the header and footer of the trace. data 参数将写入为跟踪消息的正文。The data parameter is written as the body of the trace message. ToString数据对象的方法用于将对象转换为 StringThe ToString method of the data object is used to convert the object to a String.

另请参阅

适用于

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())

参数

eventCache
TraceEventCache

包含当前进程 ID、线程 ID 以及堆栈跟踪信息的 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

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.

属性

注解

重要

此方法不应由应用程序代码直接调用,而是由、和类的成员直接调用 Debug Trace 以将 TraceSource 跟踪数据写入输出。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.

默认实现将 source 、和参数的值写入 eventType id 标头。The default implementation writes the values of the source, eventType and id parameters as a header. 数据对象使用 ToString 每个对象的方法转换为字符串。The data objects are converted to strings using the ToString method of each object. eventCache数据以页脚形式写入,输出数据的性质依赖于属性的值 TraceOutputOptionsThe eventCache data is written as a footer, the nature of the output data being dependent on the value of the TraceOutputOptions property.

另请参阅

适用于