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.

适用于