EventSource.Write 方法
定义
写入某个事件。Writes an event.
重载
Write(String) |
使用指定的名称和默认选项而非字段来写入事件。Writes an event without fields, but with the specified name and default options. |
Write(String, EventSourceOptions) |
使用指定的名称和选项而非字段来写入事件。Writes an event without fields, but with the specified name and options. |
Write<T>(String, T) |
使用指定的名称和数据写入事件。Writes an event with the specified name and data. |
Write<T>(String, EventSourceOptions, T) |
使用指定的名称、事件数据和选项写入事件。Writes an event with the specified name, event data and options. |
Write<T>(String, EventSourceOptions, T) |
使用指定的名称、选项和事件数据写入事件。Writes an event with the specified name, options and event data. |
Write<T>(String, EventSourceOptions, Guid, Guid, T) |
使用指定的名称、选项、相关活动和事件数据写入事件。Writes an event with the specified name, options, related activity and event data. |
Write(String)
使用指定的名称和默认选项而非字段来写入事件。Writes an event without fields, but with the specified name and default options.
public:
void Write(System::String ^ eventName);
public void Write (string eventName);
public void Write (string? eventName);
member this.Write : string -> unit
Public Sub Write (eventName As String)
参数
- eventName
- String
要写入的事件的名称。The name of the event to write.
例外
eventName
为 null
。eventName
is null
.
适用于
Write(String, EventSourceOptions)
使用指定的名称和选项而非字段来写入事件。Writes an event without fields, but with the specified name and options.
public:
void Write(System::String ^ eventName, System::Diagnostics::Tracing::EventSourceOptions options);
public void Write (string eventName, System.Diagnostics.Tracing.EventSourceOptions options);
public void Write (string? eventName, System.Diagnostics.Tracing.EventSourceOptions options);
member this.Write : string * System.Diagnostics.Tracing.EventSourceOptions -> unit
Public Sub Write (eventName As String, options As EventSourceOptions)
参数
- eventName
- String
要写入的事件的名称。The name of the event to write.
- options
- EventSourceOptions
事件的级别、关键字和操作代码等选项。The options such as level, keywords and operation code for the event.
例外
eventName
为 null
。eventName
is null
.
适用于
Write<T>(String, T)
使用指定的名称和数据写入事件。Writes an event with the specified name and data.
public:
generic <typename T>
void Write(System::String ^ eventName, T data);
public void Write<T> (string eventName, T data);
public void Write<T> (string? eventName, T data);
member this.Write : string * 'T -> unit
Public Sub Write(Of T) (eventName As String, data As T)
类型参数
- T
定义事件及其关联数据的类型。The type that defines the event and its associated data. 此类型必须为匿名类型或以 EventSourceAttribute 属性进行标记。This type must be an anonymous type or marked with the EventSourceAttribute attribute.
参数
- eventName
- String
事件的名称。The name of the event.
- data
- T
事件数据。The event data. 此类型必须为匿名类型或以 EventDataAttribute 属性进行标记。This type must be an anonymous type or marked with the EventDataAttribute attribute.
注解
如果 eventName
为 null
,则事件名称自动派生自类型 T 的事件数据 (Name) 或基于类型的名称确定 T
。If eventName
is null
, the event name is automatically derived from the type T's event data (Name) or determined based on the name of type T
. 的公共实例属性 data
将以递归方式进行编写,以创建事件字段。The public instance properties of data
will be written recursively to create the event fields.
适用于
Write<T>(String, EventSourceOptions, T)
使用指定的名称、事件数据和选项写入事件。Writes an event with the specified name, event data and options.
public:
generic <typename T>
void Write(System::String ^ eventName, System::Diagnostics::Tracing::EventSourceOptions options, T data);
public void Write<T> (string eventName, System.Diagnostics.Tracing.EventSourceOptions options, T data);
public void Write<T> (string? eventName, System.Diagnostics.Tracing.EventSourceOptions options, T data);
member this.Write : string * System.Diagnostics.Tracing.EventSourceOptions * 'T -> unit
Public Sub Write(Of T) (eventName As String, options As EventSourceOptions, data As T)
类型参数
- T
定义事件及其关联数据的类型。The type that defines the event and its associated data. 此类型必须为匿名类型或以 EventSourceAttribute 属性进行标记。This type must be an anonymous type or marked with the EventSourceAttribute attribute.
参数
- eventName
- String
事件的名称。The name of the event.
- options
- EventSourceOptions
事件选项。The event options.
- data
- T
事件数据。The event data. 此类型必须为匿名类型或以 EventDataAttribute 属性进行标记。This type must be an anonymous type or marked with the EventDataAttribute attribute.
注解
如果 eventName
为 null
,则事件名称自动派生自类型 T 的事件数据 (Name) 或基于类型的名称确定 T
。If eventName
is null
, the event name is automatically derived from the type T's event data (Name) or determined based on the name of type T
. 的公共实例属性 data
将以递归方式进行编写,以创建事件字段。The public instance properties of data
will be written recursively to create the event fields.
适用于
Write<T>(String, EventSourceOptions, T)
使用指定的名称、选项和事件数据写入事件。Writes an event with the specified name, options and event data.
public:
generic <typename T>
void Write(System::String ^ eventName, System::Diagnostics::Tracing::EventSourceOptions % options, T % data);
public void Write<T> (string eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref T data);
public void Write<T> (string? eventName, ref System.Diagnostics.Tracing.EventSourceOptions? options, ref T data);
member this.Write : string * EventSourceOptions * 'T -> unit
Public Sub Write(Of T) (eventName As String, ByRef options As EventSourceOptions, ByRef data As T)
类型参数
- T
定义事件及其关联数据的类型。The type that defines the event and its associated data. 此类型必须为匿名类型或以 EventSourceAttribute 属性进行标记。This type must be an anonymous type or marked with the EventSourceAttribute attribute.
参数
- eventName
- String
事件的名称。The name of the event.
- options
- EventSourceOptions
事件选项。The event options.
- data
- T
事件数据。The event data. 此类型必须为匿名类型或以 EventDataAttribute 属性进行标记。This type must be an anonymous type or marked with the EventDataAttribute attribute.
注解
如果 eventName
为 null
,则事件名称自动派生自类型 T 的事件数据 (Name) 或基于类型的名称确定 T
。If eventName
is null
, the event name is automatically derived from the type T's event data (Name) or determined based on the name of type T
. 的公共实例属性 data
将以递归方式进行编写,以创建事件字段。The public instance properties of data
will be written recursively to create the event fields.
适用于
Write<T>(String, EventSourceOptions, Guid, Guid, T)
使用指定的名称、选项、相关活动和事件数据写入事件。Writes an event with the specified name, options, related activity and event data.
public:
generic <typename T>
void Write(System::String ^ eventName, System::Diagnostics::Tracing::EventSourceOptions % options, Guid % activityId, Guid % relatedActivityId, T % data);
public void Write<T> (string eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref Guid activityId, ref Guid relatedActivityId, ref T data);
public void Write<T> (string? eventName, ref System.Diagnostics.Tracing.EventSourceOptions? options, ref Guid? activityId, ref Guid? relatedActivityId, ref T data);
member this.Write : string * EventSourceOptions * Guid * Guid * 'T -> unit
Public Sub Write(Of T) (eventName As String, ByRef options As EventSourceOptions, ByRef activityId As Guid, ByRef relatedActivityId As Guid, ByRef data As T)
类型参数
- T
定义事件及其关联数据的类型。The type that defines the event and its associated data. 此类型必须为匿名类型或以 EventSourceAttribute 属性进行标记。This type must be an anonymous type or marked with the EventSourceAttribute attribute.
参数
- eventName
- String
事件的名称。The name of the event.
- options
- EventSourceOptions
事件选项。The event options.
- activityId
- Guid
与事件关联的活动的 ID。The ID of the activity associated with the event.
- relatedActivityId
- Guid
关联活动的 ID;如果没有关联活动,则为 Empty。The ID of an associated activity, or Empty if there is no associated activity.
- data
- T
事件数据。The event data. 此类型必须为匿名类型或以 EventDataAttribute 属性进行标记。This type must be an anonymous type or marked with the EventDataAttribute attribute.
注解
如果 eventName
为 null
,则事件名称自动派生自类型 T 的事件数据 (Name) 或基于类型的名称确定 T
。If eventName
is null
, the event name is automatically derived from the type T's event data (Name) or determined based on the name of type T
. 的公共实例属性 data
将以递归方式进行编写,以创建事件字段。The public instance properties of data
will be written recursively to create the event fields.