EventLevel Výčet
Definice
Identifikuje úroveň události.Identifies the level of an event.
public enum class EventLevel
public enum EventLevel
type EventLevel =
Public Enum EventLevel
- Dědičnost
Pole
| Critical | 1 | Tato úroveň odpovídá kritické chybě, což je závažná chyba, která způsobila závažné selhání.This level corresponds to a critical error, which is a serious error that has caused a major failure. |
| Error | 2 | Tato úroveň přidává standardní chyby, které signalizují problém.This level adds standard errors that signify a problem. |
| Informational | 4 | Tato úroveň přidává informativní události nebo zprávy, které nejsou chyby.This level adds informational events or messages that are not errors. Tyto události mohou pomáhat sledovat průběh nebo stav aplikace.These events can help trace the progress or state of an application. |
| LogAlways | 0 | Pro událost se neprovádí žádné filtrování na úrovni.No level filtering is done on the event. |
| Verbose | 5 | Tato úroveň přidá dlouhé události nebo zprávy.This level adds lengthy events or messages. Způsobí, že budou protokolovány všechny události.It causes all events to be logged. |
| Warning | 3 | Tato úroveň přidá události upozornění (například události, které jsou publikovány, protože disk se blíží plné kapacitě).This level adds warning events (for example, events that are published because a disk is nearing full capacity). |
Příklady
Následující příklad ukazuje, jak použít Error člena výčtu k identifikaci chybové zprávy.The following example shows how to use the Error enumeration member to identify an error message. Tento příklad je součástí většího příkladu, který je k dispozici pro EventSource třídu.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
Následující příklad ukazuje, jak použít Informational člena výčtu k identifikaci informační zprávy.The following example shows how to use the Informational enumeration member to identify an informational message. Tento příklad je součástí většího příkladu, který je k dispozici pro EventSource třídu.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
Následující příklad ukazuje, jak použít Verbose člena výčtu k identifikaci podrobné zprávy.The following example shows how to use the Verbose enumeration member to identify a verbose message. Tento příklad je součástí většího příkladu, který je k dispozici pro EventSource třídu.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
Poznámky
Úroveň znamená závažnost události.The level signifies the severity of an event. Nižší úrovně závažnosti zahrnují vyšší úrovně závažnosti.Lower severity levels encompass higher severity levels. Například Warning obsahuje Error Critical úrovně a, které jsou v závažnosti vyšší.For example, Warning includes the Error and Critical levels, which are higher in severity.