通过


TraceListener.TraceEvent 方法

定义

将跟踪和事件信息写入侦听器特定的输出。

重载

名称 说明
TraceEvent(TraceEventCache, String, TraceEventType, Int32)

将跟踪和事件信息写入侦听器特定的输出。

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

将跟踪信息、消息和事件信息写入侦听器特定的输出。

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

将跟踪信息、格式化的对象数组和事件信息写入侦听器特定的输出。

TraceEvent(TraceEventCache, String, TraceEventType, Int32)

Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs

将跟踪和事件信息写入侦听器特定的输出。

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)

参数

eventCache
TraceEventCache

包含 TraceEventCache 当前进程 ID、线程 ID 和堆栈跟踪信息的对象。

source
String

用于标识输出的名称,通常是生成跟踪事件的应用程序的名称。

eventType
TraceEventType

TraceEventType指定导致跟踪的事件类型的值之一。

id
Int32

事件的数值标识符。

属性

注解

重要

此方法不是由应用程序代码直接调用,而是由应用程序代码的成员DebugTraceTraceSource类调用,用于将跟踪数据写入输出。

默认实现将参数的值sourceeventTypeid写入标头。 数据 eventCache 以页脚形式写入,输出数据的性质取决于属性的值 TraceOutputOptions

另请参阅

适用于

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

Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs

将跟踪信息、消息和事件信息写入侦听器特定的输出。

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)

参数

eventCache
TraceEventCache

包含 TraceEventCache 当前进程 ID、线程 ID 和堆栈跟踪信息的对象。

source
String

用于标识输出的名称,通常是生成跟踪事件的应用程序的名称。

eventType
TraceEventType

TraceEventType指定导致跟踪的事件类型的值之一。

id
Int32

事件的数值标识符。

message
String

要写入的消息。

属性

注解

重要

此方法不是由应用程序代码直接调用,而是由应用程序代码的成员DebugTraceTraceSource类调用,用于将跟踪数据写入输出。

默认实现将参数的值sourceeventTypeid写入标头,后跟message数据。 数据 eventCache 以页脚形式写入,输出数据的性质取决于属性的值 TraceOutputOptions

另请参阅

适用于

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

Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs

将跟踪信息、格式化的对象数组和事件信息写入侦听器特定的输出。

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

参数

eventCache
TraceEventCache

包含 TraceEventCache 当前进程 ID、线程 ID 和堆栈跟踪信息的对象。

source
String

用于标识输出的名称,通常是生成跟踪事件的应用程序的名称。

eventType
TraceEventType

TraceEventType指定导致跟踪的事件类型的值之一。

id
Int32

事件的数值标识符。

format
String

一个格式字符串,其中包含零个或多个格式项,它们对应于数组中的 args 对象。

args
Object[]

包含 object 要设置格式的零个或多个对象的数组。

属性

注解

重要

此方法不是由应用程序代码直接调用,而是由应用程序代码的成员DebugTraceTraceSource类调用,用于将跟踪数据写入输出。

默认实现将参数的值sourceeventTypeid写入标头。 对象 args 数组使用 Format 该方法转换为字符串,传递 format 字符串和 args 数组以将字符串格式化为跟踪的消息部分。 数据 eventCache 以页脚形式写入,输出数据的性质取决于属性的值 TraceOutputOptions

另请参阅

适用于