EventLevel EventLevel EventLevel EventLevel Enum

定義

識別事件的層級。Identifies the level of an event.

public enum class EventLevel
public enum EventLevel
type EventLevel = 
Public Enum EventLevel
繼承

欄位

Critical Critical Critical Critical 1

這個等級會對應至嚴重錯誤,也就是造成重大失敗的嚴重錯誤。This level corresponds to a critical error, which is a serious error that has caused a major failure.

Error Error Error Error 2

這個層級新增表示問題的標準錯誤。This level adds standard errors that signify a problem.

Informational Informational Informational Informational 4

這個等級會加入非錯誤的告知性事件或訊息。This level adds informational events or messages that are not errors. 這些事件有助於追蹤應用程式的進度或狀態。These events can help trace the progress or state of an application.

LogAlways LogAlways LogAlways LogAlways 0

未對事件進行任何層級篩選。No level filtering is done on the event.

Verbose Verbose Verbose Verbose 5

這個等級會加入冗長的事件或訊息。This level adds lengthy events or messages. 它會讓所有事件記錄下來。It causes all events to be logged.

Warning Warning Warning Warning 3

這個等級會加入警告事件 (例如,磁碟容量快不夠時,所發行的事件)。This level adds warning events (for example, events that are published because a disk is nearing full capacity).

範例

下列範例示範如何使用Error列舉成員,才能找出錯誤訊息。The following example shows how to use the Error enumeration member to identify an error message. 這個範例是針對提供之較大範例的一部分EventSource類別。This example is part of a larger example provided for the EventSource class.

[Event(1, Message = "Application Failure: {0}", Level = EventLevel.Error, Keywords = Keywords.Diagnostic)]
public void Failure(string message) { WriteEvent(1, message); }
<[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

下列範例示範如何使用Informational列舉成員,來識別參考用訊息。The following example shows how to use the Informational enumeration member to identify an informational message. 這個範例是針對提供之較大範例的一部分EventSource類別。This example is part of a larger example provided for the EventSource class.

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

下列範例示範如何使用Verbose列舉成員,才能找出詳細資訊訊息。The following example shows how to use the Verbose enumeration member to identify a verbose message. 這個範例是針對提供之較大範例的一部分EventSource類別。This example is part of a larger example provided for the EventSource class.

[Event(7, Level = EventLevel.Verbose, Keywords = Keywords.DataBase)]
public void Mark(int ID) { if (IsEnabled()) WriteEvent(7, ID); }
<[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

備註

這個等級表示事件的嚴重性。The level signifies the severity of an event. 較低的嚴重性層級包含較高的嚴重性層級。Lower severity levels encompass higher severity levels. 比方說,警告會包含錯誤和嚴重層級,也就是較高的嚴重性。For example, Warning includes the Error and Critical levels, which are higher in severity.

適用於