EventSource EventSource EventSource EventSource Class

定義

提供建立 Windows 事件追蹤 (ETW) 事件的能力。Provides the ability to create events for event tracing for Windows (ETW).

public ref class EventSource : IDisposable
public class EventSource : IDisposable
type EventSource = class
    interface IDisposable
Public Class EventSource
Implements IDisposable
繼承
EventSourceEventSourceEventSourceEventSource
實作

範例

下列範例示範的簡單實作EventSource類別。The following example shows a simple implementation of the EventSource class.

using System.Diagnostics.Tracing;
using System.Collections.Generic;

namespace Demo1
{
    class MyCompanyEventSource : EventSource
    {
        public static MyCompanyEventSource Log = new MyCompanyEventSource();

        public void Startup() { WriteEvent(1); }
        public void OpenFileStart(string fileName) { WriteEvent(2, fileName); }
        public void OpenFileStop() { WriteEvent(3); }
    }

    class Program
    {
        static void Main(string[] args)
        {
            string name = MyCompanyEventSource.GetName(typeof(MyCompanyEventSource));
            IEnumerable<EventSource> eventSources = MyCompanyEventSource.GetSources();
            MyCompanyEventSource.Log.Startup();
            // ...
            MyCompanyEventSource.Log.OpenFileStart("SomeFile");
            // ...
            MyCompanyEventSource.Log.OpenFileStop();
        }
    }
}
Imports System.Diagnostics.Tracing

Class MyCompanyEventSource
    Inherits EventSource
    Public Shared Log As New MyCompanyEventSource()

    Public Sub Startup()
        WriteEvent(1)
    End Sub 'Startup

    Public Sub OpenFileStart(ByVal fileName As String)
        WriteEvent(2, fileName)
    End Sub 'OpenFileStart

    Public Sub OpenFileStop()
        WriteEvent(3)
    End Sub 'OpenFileStop
End Class 'MyCompanyEventSource 

Class Program

    Shared Sub Main(ByVal args() As String)
        MyCompanyEventSource.Log.Startup()
        ' ...
        MyCompanyEventSource.Log.OpenFileStart("SomeFile")
        ' ...
        MyCompanyEventSource.Log.OpenFileStop()

    End Sub 'Main
End Class 'Program

下列範例示範的更複雜的實作EventSource類別。The following example shows a more complex implementation of the EventSource class.

using System;
using System.Diagnostics.Tracing;

namespace Demo2
{
    enum MyColor { Red, Yellow, Blue };

    [EventSource(Name = "MyCompany")]
    class MyCompanyEventSource : EventSource
    {
        public class Keywords
        {
            public const EventKeywords Page = (EventKeywords)1;
            public const EventKeywords DataBase = (EventKeywords)2;
            public const EventKeywords Diagnostic = (EventKeywords)4;
            public const EventKeywords Perf = (EventKeywords)8;
        }

        public class Tasks
        {
            public const EventTask Page = (EventTask)1;
            public const EventTask DBQuery = (EventTask)2;
        }

        [Event(1, Message = "Application Failure: {0}", Level = EventLevel.Error, Keywords = Keywords.Diagnostic)]
        public void Failure(string message) { WriteEvent(1, message); }

        [Event(2, Message = "Starting up.", Keywords = Keywords.Perf, Level = EventLevel.Informational)]
        public void Startup() { WriteEvent(2); }

        [Event(3, Message = "loading page {1} activityID={0}", Opcode = EventOpcode.Start, 
            Task = Tasks.Page, Keywords = Keywords.Page, Level = EventLevel.Informational)]
        public void PageStart(int ID, string url) { if (IsEnabled()) WriteEvent(3, ID, url); }

        [Event(4, Opcode = EventOpcode.Stop, Task = Tasks.Page, Keywords = Keywords.Page, Level = EventLevel.Informational)]
        public void PageStop(int ID) { if (IsEnabled()) WriteEvent(4, ID); }

        [Event(5, Opcode = EventOpcode.Start, Task = Tasks.DBQuery, Keywords = Keywords.DataBase, Level = EventLevel.Informational)]
        public void DBQueryStart(string sqlQuery) { WriteEvent(5, sqlQuery); }

        [Event(6, Opcode = EventOpcode.Stop, Task = Tasks.DBQuery, Keywords = Keywords.DataBase, Level = EventLevel.Informational)]
        public void DBQueryStop() { WriteEvent(6); }

        [Event(7, Level = EventLevel.Verbose, Keywords = Keywords.DataBase)]
        public void Mark(int ID) { if (IsEnabled()) WriteEvent(7, ID); }

        [Event(8)]
        public void LogColor(MyColor color) { WriteEvent(8, (int) color); }

        public static MyCompanyEventSource Log = new MyCompanyEventSource();
    }

    class Program
    {
        static void Main(string[] args)
        {
            MyCompanyEventSource.Log.Startup();
            Console.WriteLine("Starting up");

            MyCompanyEventSource.Log.DBQueryStart("Select * from MYTable");
            var url = "http://localhost";
            for (int i = 0; i < 10; i++)
            {
                MyCompanyEventSource.Log.PageStart(i, url);
                MyCompanyEventSource.Log.Mark(i);
                MyCompanyEventSource.Log.PageStop(i);
            }
            MyCompanyEventSource.Log.DBQueryStop();
            MyCompanyEventSource.Log.LogColor(MyColor.Blue);

            MyCompanyEventSource.Log.Failure("This is a failure 1");
            MyCompanyEventSource.Log.Failure("This is a failure 2");
            MyCompanyEventSource.Log.Failure("This is a failure 3");
        }
    }
}
Imports System
Imports System.Diagnostics.Tracing


Enum MyColor
    Red
    Yellow
    Blue
End Enum 'MyColor 
<EventSource(Name:="MyCompany")> _
Class MyCompanyEventSource
    Inherits EventSource

    Public Class Keywords
        Public Const Page As EventKeywords = CType(1, EventKeywords)
        Public Const DataBase As EventKeywords = CType(2, EventKeywords)
        Public Const Diagnostic As EventKeywords = CType(4, EventKeywords)
        Public Const Perf As EventKeywords = CType(8, EventKeywords)
    End Class 'Keywords

    Public Class Tasks
        Public Const Page As EventTask = CType(1, EventTask)
        Public Const DBQuery As EventTask = CType(1, EventTask)
    End Class 'Tasks

    <[Event](1, Message:="Application Failure: {0}", Level:=EventLevel.Error, Keywords:=Keywords.Diagnostic)> _
    Public Sub Failure(ByVal message As String)
        WriteEvent(1, message)
    End Sub 'Failure

    <[Event](2, Message:="Starting up.", Keywords:=Keywords.Perf, Level:=EventLevel.Informational)> _
    Public Sub Startup()
        WriteEvent(2)
    End Sub 'Startup

    <[Event](3, Message:="loading page {1} activityID={0}", Opcode:=EventOpcode.Start, Task:=Tasks.Page, Keywords:=Keywords.Page, Level:=EventLevel.Informational)> _
    Public Sub PageStart(ByVal ID As Integer, ByVal url As String)
        If IsEnabled() Then
            WriteEvent(3, ID, url)
        End If
    End Sub 'PageStart

    <[Event](4, Opcode:=EventOpcode.Stop, Task:=Tasks.Page, Keywords:=Keywords.Page, Level:=EventLevel.Informational)> _
    Public Sub PageStop(ByVal ID As Integer)
        If IsEnabled() Then
            WriteEvent(4, ID)
        End If
    End Sub 'PageStop

    <[Event](5, Opcode:=EventOpcode.Start, Task:=Tasks.DBQuery, Keywords:=Keywords.DataBase, Level:=EventLevel.Informational)> _
    Public Sub DBQueryStart(ByVal sqlQuery As String)
        WriteEvent(5, sqlQuery)
    End Sub 'DBQueryStart

    <[Event](6, Opcode:=EventOpcode.Stop, Task:=Tasks.DBQuery, Keywords:=Keywords.DataBase, Level:=EventLevel.Informational)> _
    Public Sub DBQueryStop()
        WriteEvent(6)
    End Sub 'DBQueryStop

    <[Event](7, Level:=EventLevel.Verbose, Keywords:=Keywords.DataBase)> _
    Public Sub Mark(ByVal ID As Integer)
        If IsEnabled() Then
            WriteEvent(7, ID)
        End If
    End Sub 'Mark

    <[Event](8)> _
    Public Sub LogColor(ByVal color As MyColor)
        WriteEvent(8, Fix(color))
    End Sub 'LogColor 
    Public Shared Log As New MyCompanyEventSource()
End Class 'MyCompanyEventSource


Class Program

    Shared Sub Main(ByVal args() As String)
        MyCompanyEventSource.Log.Startup()
        Console.WriteLine("Starting up")
        MyCompanyEventSource.Log.DBQueryStart("Select * from MYTable")
        Dim url As String = "http:'localhost"
        Dim i As Integer
        For i = 0 To 9
            MyCompanyEventSource.Log.PageStart(i, url)
            MyCompanyEventSource.Log.Mark(i)
            MyCompanyEventSource.Log.PageStop(i)
        Next i
        MyCompanyEventSource.Log.DBQueryStop()
        MyCompanyEventSource.Log.LogColor(MyColor.Blue)

        MyCompanyEventSource.Log.Failure("This is a failure 1")
        MyCompanyEventSource.Log.Failure("This is a failure 2")
        MyCompanyEventSource.Log.Failure("This is a failure 3")
    End Sub 'Main
End Class 'Program

備註

這個類別被要提供特定用於 ETW 事件的使用者類別繼承。This class is intended to be inherited by a user class that provides specific events to be used for ETW. EventSource.WriteEvent方法會呼叫以記錄的事件。The EventSource.WriteEvent methods are called to log the events.

重要

此類型會實作IDisposable介面。This type implements the IDisposable interface. 當您完成使用型別時,您應該處置它直接或間接。When you have finished using the type, you should dispose of it either directly or indirectly. 若要直接處置型別,呼叫其Dispose方法中的try / catch區塊。To dispose of the type directly, call its Dispose method in a try/catch block. 若要處置它間接,使用的語言建構這類using(在 C# 中) 或Using(在 Visual Basic)。To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). 如需詳細資訊,請參閱 「 使用物件,實作 IDisposable 」 一節IDisposable介面 > 主題。For more information, see the "Using an Object that Implements IDisposable" section in the IDisposable interface topic.

基本功能EventSource就足以應付大部分的應用程式。The basic functionality of EventSource is sufficient for most applications. 如果您想要更充分掌控所建立的 ETW 資訊清單,您可以套用EventAttribute屬性的方法。If you want more control over the ETW manifest that is created, you can apply the EventAttribute attribute to the methods. 針對進階級項目來源的應用程式,就可以攔截到衍生的事件來源正在傳送的命令,並變更篩選,或造成動作 (例如傾印的資料結構) 要執行的繼承。For advanced event source applications, it is possible to intercept the commands being sent to the derived event source and change the filtering, or to cause actions (such as dumping a data structure) to be performed by the inheritor. 可以與 Windows ETW 控制站,例如 Logman 工具,立即啟動事件來源。An event source can be activated with Windows ETW controllers, such as the Logman tool, immediately. 也可以以程式設計方式控制和攔截資料發送器的位置。It is also possible to programmatically control and intercept the data dispatcher. EventListener類別提供額外的功能。The EventListener class provides additional functionality.

開頭.NET Framework 4.6.NET Framework 4.6EventSource提供放寬通道支援和一些事件來源的驗證規則。Starting with .NET Framework 4.6.NET Framework 4.6, EventSource provides channel support and some of the event source validation rules have been relaxed. 這表示:This means:

  • EventSource 類型現在可能會實作介面。EventSource types may now implement interfaces. 這會啟用事件來源類型的進階的記錄系統中使用介面定義通用的記錄目標。This enables the use of event source types in advanced logging systems that use interfaces to define a common logging target.

  • 已導入的公用程式的事件來源類型的概念。The concept of a utility event source type has been introduced. 這項功能可讓共用的程式碼分散到多個事件來源型別在專案中啟用的案例,例如最佳化WriteEvent多載。This feature enables sharing code across multiple event source types in a project to enable scenarios such as optimized WriteEvent overloads.

針對新版EventSource類別,可提供功能,例如通道可支援您的目標.NET Framework 4.5.1.NET Framework 4.5.1或更早版本,請參閱Microsoft EventSource 程式庫 1.0.16For a version of the EventSource class that provides features such as channel support you are targeting .NET Framework 4.5.1.NET Framework 4.5.1 or earlier, see Microsoft EventSource Library 1.0.16.

建構函式

EventSource() EventSource() EventSource() EventSource()

建立 EventSource 類別的新執行個體。Creates a new instance of the EventSource class.

EventSource(Boolean) EventSource(Boolean) EventSource(Boolean) EventSource(Boolean)

建立 EventSource 類別的新執行個體,並指定當基礎 Windows 程式碼發生錯誤時是否擲回例外狀況。Creates a new instance of the EventSource class and specifies whether to throw an exception when an error occurs in the underlying Windows code.

EventSource(EventSourceSettings) EventSource(EventSourceSettings) EventSource(EventSourceSettings) EventSource(EventSourceSettings)

使用指定的組態設定,建立 EventSource 類別的新執行個體。Creates a new instance of the EventSource class with the specified configuration settings.

EventSource(EventSourceSettings, String[]) EventSource(EventSourceSettings, String[]) EventSource(EventSourceSettings, String[]) EventSource(EventSourceSettings, String[])

初始化要與非合約事件搭配使用之 EventSource 的新執行個體,這些事件包含指定的設定和特性。Initializes a new instance of the EventSource to be used with non-contract events that contains the specified settings and traits.

EventSource(String) EventSource(String) EventSource(String) EventSource(String)

使用指定的名稱,建立 EventSource 類別的新執行個體。Creates a new instance of the EventSource class with the specified name.

EventSource(String, EventSourceSettings) EventSource(String, EventSourceSettings) EventSource(String, EventSourceSettings) EventSource(String, EventSourceSettings)

使用指定的名稱和設定,建立 EventSource 類別的新執行個體。Creates a new instance of the EventSource class with the specified name and settings.

EventSource(String, EventSourceSettings, String[]) EventSource(String, EventSourceSettings, String[]) EventSource(String, EventSourceSettings, String[]) EventSource(String, EventSourceSettings, String[])

使用指定的組態設定,建立 EventSource 類別的新執行個體。Creates a new instance of the EventSource class with the specified configuration settings.

屬性

ConstructionException ConstructionException ConstructionException ConstructionException

取得事件來源建構期間擲回的任何例外狀況。Gets any exception that was thrown during the construction of the event source.

CurrentThreadActivityId CurrentThreadActivityId CurrentThreadActivityId CurrentThreadActivityId

取得目前執行緒的活動識別碼。Gets the activity ID of the current thread.

Guid Guid Guid Guid

事件來源的唯一識別項。The unique identifier for the event source.

Name Name Name Name

衍生自事件來源的類別的好記名稱。The friendly name of the class that is derived from the event source.

Settings Settings Settings Settings

取得套用至這個事件來源的設定。Gets the settings applied to this event source.

方法

Dispose() Dispose() Dispose() Dispose()

釋放 EventSource 類別目前的執行個體所使用的全部資源。Releases all resources used by the current instance of the EventSource class.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

釋放 EventSource 類別所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the EventSource class and optionally releases the managed resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize() Finalize() Finalize() Finalize()

允許 EventSource 物件嘗試釋放資源,並執行其他清除作業,不必等到記憶體回收回收物件。Allows the EventSource object to attempt to free resources and perform other cleanup operations before the object is reclaimed by garbage collection.

GenerateManifest(Type, String) GenerateManifest(Type, String) GenerateManifest(Type, String) GenerateManifest(Type, String)

傳回 XML 資訊清單的字串,與目前的事件來源相關。Returns a string of the XML manifest that is associated with the current event source.

GenerateManifest(Type, String, EventManifestOptions) GenerateManifest(Type, String, EventManifestOptions) GenerateManifest(Type, String, EventManifestOptions) GenerateManifest(Type, String, EventManifestOptions)

傳回 XML 資訊清單的字串,與目前的事件來源相關。Returns a string of the XML manifest that is associated with the current event source.

GetGuid(Type) GetGuid(Type) GetGuid(Type) GetGuid(Type)

取得這項事件來源實作的唯一識別項。Gets the unique identifier for this implementation of the event source.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetName(Type) GetName(Type) GetName(Type) GetName(Type)

取得事件來源的易記名稱。Gets the friendly name of the event source.

GetSources() GetSources() GetSources() GetSources()

取得應用程式定義域中所有事件來源的快照。Gets a snapshot of all the event sources for the application domain.

GetTrait(String) GetTrait(String) GetTrait(String) GetTrait(String)

取得與指定索引鍵關聯的特性值。Gets the trait value associated with the specified key.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
IsEnabled() IsEnabled() IsEnabled() IsEnabled()

判斷是否已啟用目前的事件來源。Determines whether the current event source is enabled.

IsEnabled(EventLevel, EventKeywords) IsEnabled(EventLevel, EventKeywords) IsEnabled(EventLevel, EventKeywords) IsEnabled(EventLevel, EventKeywords)

判斷是否已啟用具有指定之層級和關鍵字的目前事件來源。Determines whether the current event source that has the specified level and keyword is enabled.

IsEnabled(EventLevel, EventKeywords, EventChannel) IsEnabled(EventLevel, EventKeywords, EventChannel) IsEnabled(EventLevel, EventKeywords, EventChannel) IsEnabled(EventLevel, EventKeywords, EventChannel)

判斷具有指定的層級、關鍵字和通道的事件是否已啟用目前的事件來源。Determines whether the current event source is enabled for events with the specified level, keywords and channel.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
OnEventCommand(EventCommandEventArgs) OnEventCommand(EventCommandEventArgs) OnEventCommand(EventCommandEventArgs) OnEventCommand(EventCommandEventArgs)

當控制器更新目前事件來源時呼叫。Called when the current event source is updated by the controller.

SendCommand(EventSource, EventCommand, IDictionary<String,String>) SendCommand(EventSource, EventCommand, IDictionary<String,String>) SendCommand(EventSource, EventCommand, IDictionary<String,String>) SendCommand(EventSource, EventCommand, IDictionary<String,String>)

傳送命令到指定的事件來源。Sends a command to a specified event source.

SetCurrentThreadActivityId(Guid) SetCurrentThreadActivityId(Guid) SetCurrentThreadActivityId(Guid) SetCurrentThreadActivityId(Guid)

設定目前執行緒的活動識別碼。Sets the activity ID on the current thread.

SetCurrentThreadActivityId(Guid, Guid) SetCurrentThreadActivityId(Guid, Guid) SetCurrentThreadActivityId(Guid, Guid) SetCurrentThreadActivityId(Guid, Guid)

設定目前執行緒的活動識別碼,並傳回上一個活動識別碼。Sets the activity ID on the current thread, and returns the previous activity ID.

ToString() ToString() ToString() ToString()

取得目前事件來源執行個體的字串表示。Obtains a string representation of the current event source instance.

Write(String) Write(String) Write(String) Write(String)

寫入不含欄位,但具有指定名稱和預設選項的事件。Writes an event without fields, but with the specified name and default options.

Write(String, EventSourceOptions) Write(String, EventSourceOptions) Write(String, EventSourceOptions) Write(String, EventSourceOptions)

寫入不含欄位,但具有指定名稱和選項的事件。Writes an event without fields, but with the specified name and options.

Write<T>(String, EventSourceOptions, Guid, Guid, T) Write<T>(String, EventSourceOptions, Guid, Guid, T) Write<T>(String, EventSourceOptions, Guid, Guid, T) Write<T>(String, EventSourceOptions, Guid, Guid, T)

寫入具有指定名稱、選項、相關活動和事件資料的事件。Writes an event with the specified name, options, related activity and event data.

Write<T>(String, EventSourceOptions, T) Write<T>(String, EventSourceOptions, T) Write<T>(String, EventSourceOptions, T) Write<T>(String, EventSourceOptions, T)

寫入具有指定名稱、選項和事件資料的事件。Writes an event with the specified name, options and event data.

Write<T>(String, EventSourceOptions, T) Write<T>(String, EventSourceOptions, T) Write<T>(String, EventSourceOptions, T) Write<T>(String, EventSourceOptions, T)

寫入具有指定名稱、事件資料和選項的事件。Writes an event with the specified name, event data and options.

Write<T>(String, T) Write<T>(String, T) Write<T>(String, T) Write<T>(String, T)

寫入具有指定名稱和資料的事件。Writes an event with the specified name and data.

WriteEvent(Int32) WriteEvent(Int32) WriteEvent(Int32) WriteEvent(Int32)

使用所提供的事件識別元,寫入事件。Writes an event by using the provided event identifier.

WriteEvent(Int32, Byte[]) WriteEvent(Int32, Byte[]) WriteEvent(Int32, Byte[]) WriteEvent(Int32, Byte[])

使用所提供的事件識別項和位元組陣列引數,寫入事件。Writes an event by using the provided event identifier and byte array argument.

WriteEvent(Int32, Int32) WriteEvent(Int32, Int32) WriteEvent(Int32, Int32) WriteEvent(Int32, Int32)

使用所提供的事件識別元和 32 位元整數引數,寫入事件。Writes an event by using the provided event identifier and 32-bit integer argument.

WriteEvent(Int32, Int32, Int32) WriteEvent(Int32, Int32, Int32) WriteEvent(Int32, Int32, Int32) WriteEvent(Int32, Int32, Int32)

使用所提供的事件識別元和 32 位元整數引數,寫入事件。Writes an event by using the provided event identifier and 32-bit integer arguments.

WriteEvent(Int32, Int32, Int32, Int32) WriteEvent(Int32, Int32, Int32, Int32) WriteEvent(Int32, Int32, Int32, Int32) WriteEvent(Int32, Int32, Int32, Int32)

使用所提供的事件識別元和 32 位元整數引數,寫入事件。Writes an event by using the provided event identifier and 32-bit integer arguments.

WriteEvent(Int32, Int32, String) WriteEvent(Int32, Int32, String) WriteEvent(Int32, Int32, String) WriteEvent(Int32, Int32, String)

使用所提供的事件識別項、32 位元整數和字串引數,寫入事件。Writes an event by using the provided event identifier and 32-bit integer and string arguments.

WriteEvent(Int32, Int64) WriteEvent(Int32, Int64) WriteEvent(Int32, Int64) WriteEvent(Int32, Int64)

使用所提供的事件識別元和 64 位元整數引數,寫入事件。Writes an event by using the provided event identifier and 64-bit integer argument.

WriteEvent(Int32, Int64, Byte[]) WriteEvent(Int32, Int64, Byte[]) WriteEvent(Int32, Int64, Byte[]) WriteEvent(Int32, Int64, Byte[])

使用指定的識別項、64 位元整數和位元組陣列引數,寫入事件資料。Writes the event data using the specified identifier and 64-bit integer and byte array arguments.

WriteEvent(Int32, Int64, Int64) WriteEvent(Int32, Int64, Int64) WriteEvent(Int32, Int64, Int64) WriteEvent(Int32, Int64, Int64)

使用所提供的事件識別元和 64 位元整數引數,寫入事件。Writes an event by using the provided event identifier and 64-bit arguments.

WriteEvent(Int32, Int64, Int64, Int64) WriteEvent(Int32, Int64, Int64, Int64) WriteEvent(Int32, Int64, Int64, Int64) WriteEvent(Int32, Int64, Int64, Int64)

使用所提供的事件識別元和 64 位元整數引數,寫入事件。Writes an event by using the provided event identifier and 64-bit arguments.

WriteEvent(Int32, Int64, String) WriteEvent(Int32, Int64, String) WriteEvent(Int32, Int64, String) WriteEvent(Int32, Int64, String)

使用所提供的事件識別項、64 位元整數和字串引數,寫入事件。Writes an event by using the provided event identifier and 64-bit integer, and string arguments.

WriteEvent(Int32, Object[]) WriteEvent(Int32, Object[]) WriteEvent(Int32, Object[]) WriteEvent(Int32, Object[])

使用所提供的事件識別元和引數陣列,寫入事件。Writes an event by using the provided event identifier and array of arguments.

WriteEvent(Int32, String) WriteEvent(Int32, String) WriteEvent(Int32, String) WriteEvent(Int32, String)

使用所提供的事件識別元和字串引數,寫入事件。Writes an event by using the provided event identifier and string argument.

WriteEvent(Int32, String, Int32) WriteEvent(Int32, String, Int32) WriteEvent(Int32, String, Int32) WriteEvent(Int32, String, Int32)

使用所提供的事件識別元和引數,寫入事件。Writes an event by using the provided event identifier and arguments.

WriteEvent(Int32, String, Int32, Int32) WriteEvent(Int32, String, Int32, Int32) WriteEvent(Int32, String, Int32, Int32) WriteEvent(Int32, String, Int32, Int32)

使用所提供的事件識別元和引數,寫入事件。Writes an event by using the provided event identifier and arguments.

WriteEvent(Int32, String, Int64) WriteEvent(Int32, String, Int64) WriteEvent(Int32, String, Int64) WriteEvent(Int32, String, Int64)

使用所提供的事件識別元和引數,寫入事件。Writes an event by using the provided event identifier and arguments.

WriteEvent(Int32, String, String) WriteEvent(Int32, String, String) WriteEvent(Int32, String, String) WriteEvent(Int32, String, String)

使用所提供的事件識別元和字串引數,寫入事件。Writes an event by using the provided event identifier and string arguments.

WriteEvent(Int32, String, String, String) WriteEvent(Int32, String, String, String) WriteEvent(Int32, String, String, String) WriteEvent(Int32, String, String, String)

使用所提供的事件識別元和字串引數,寫入事件。Writes an event by using the provided event identifier and string arguments.

WriteEventCore(Int32, Int32, EventSource+EventData*) WriteEventCore(Int32, Int32, EventSource+EventData*) WriteEventCore(Int32, Int32, EventSource+EventData*) WriteEventCore(Int32, Int32, EventSource+EventData*)

使用所提供的事件識別項和事件資料,建立新的 WriteEvent 多載。Creates a new WriteEvent overload by using the provided event identifier and event data.

WriteEventWithRelatedActivityId(Int32, Guid, Object[]) WriteEventWithRelatedActivityId(Int32, Guid, Object[]) WriteEventWithRelatedActivityId(Int32, Guid, Object[]) WriteEventWithRelatedActivityId(Int32, Guid, Object[])

寫入表示目前活動與另一個活動有關的事件。Writes an event that indicates that the current activity is related to another activity.

WriteEventWithRelatedActivityIdCore(Int32, Guid*, Int32, EventSource+EventData*) WriteEventWithRelatedActivityIdCore(Int32, Guid*, Int32, EventSource+EventData*) WriteEventWithRelatedActivityIdCore(Int32, Guid*, Int32, EventSource+EventData*) WriteEventWithRelatedActivityIdCore(Int32, Guid*, Int32, EventSource+EventData*)

寫入表示目前活動與另一個活動有關的事件。Writes an event that indicates that the current activity is related to another activity.

事件

EventCommandExecuted EventCommandExecuted EventCommandExecuted EventCommandExecuted

發生於命令來自事件接聽程式時。Occurs when a command comes from an event listener.

適用於

執行緒安全性

此型別具備執行緒安全。This type is thread safe.