EventLevel Enum

Definition

Identifies the level of an event.

public enum class EventLevel
public enum EventLevel
type EventLevel = 
Public Enum EventLevel
Inheritance
EventLevel

Fields

Critical 1

This level corresponds to a critical error, which is a serious error that has caused a major failure.

Error 2

This level adds standard errors that signify a problem.

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 0

No level filtering is done on the event.

Verbose 5

This level adds lengthy events or messages. It causes all events to be logged.

Warning 3

This level adds warning events (for example, events that are published because a disk is nearing full capacity).

Examples

The following example shows how to use the Error enumeration member to identify an error message. 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

The following example shows how to use the Informational enumeration member to identify an informational message. 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

The following example shows how to use the Verbose enumeration member to identify a verbose message. 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

Remarks

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.

Applies to