EventSource.IsEnabled 方法

定义

确定是否已启用当前事件源。Determines whether the current event source is enabled.

重载

IsEnabled()

确定是否已启用当前事件源。Determines whether the current event source is enabled.

IsEnabled(EventLevel, EventKeywords)

确定是否已启用具有指定级别和关键字的当前事件源。Determines whether the current event source that has the specified level and keyword is enabled.

IsEnabled(EventLevel, EventKeywords, EventChannel)

确定是否对带有指定级别、关键字和通道的事件启用了当前事件源。Determines whether the current event source is enabled for events with the specified level, keywords and channel.

IsEnabled()

确定是否已启用当前事件源。Determines whether the current event source is enabled.

public:
 bool IsEnabled();
public bool IsEnabled ();
member this.IsEnabled : unit -> bool
Public Function IsEnabled () As Boolean

返回

Boolean

如果启用了当前事件源,则为 true;否则为 falsetrue if the current event source is enabled; otherwise, false.

适用于

IsEnabled(EventLevel, EventKeywords)

确定是否已启用具有指定级别和关键字的当前事件源。Determines whether the current event source that has the specified level and keyword is enabled.

public:
 bool IsEnabled(System::Diagnostics::Tracing::EventLevel level, System::Diagnostics::Tracing::EventKeywords keywords);
public bool IsEnabled (System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords keywords);
member this.IsEnabled : System.Diagnostics.Tracing.EventLevel * System.Diagnostics.Tracing.EventKeywords -> bool
Public Function IsEnabled (level As EventLevel, keywords As EventKeywords) As Boolean

参数

level
EventLevel

事件源级别。The level of the event source.

keywords
EventKeywords

事件源的关键字。The keyword of the event source.

返回

Boolean

如果启用了事件源,则为 true;否则为 falsetrue if the event source is enabled; otherwise, false.

注解

通过此方法的结果仅可大概了解特定的事件是否处于活动状态。The result of this method is only an approximation of whether a particular event is active. 使用它可避免在禁用了记录的情况下因记录造成昂贵的计算费用。Use it to avoid expensive computation for logging when logging is disabled. 事件源可能具有确定其活动的其他筛选。Event sources may have additional filtering that determines their activity.

适用于

IsEnabled(EventLevel, EventKeywords, EventChannel)

确定是否对带有指定级别、关键字和通道的事件启用了当前事件源。Determines whether the current event source is enabled for events with the specified level, keywords and channel.

public:
 bool IsEnabled(System::Diagnostics::Tracing::EventLevel level, System::Diagnostics::Tracing::EventKeywords keywords, System::Diagnostics::Tracing::EventChannel channel);
public bool IsEnabled (System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords keywords, System.Diagnostics.Tracing.EventChannel channel);
member this.IsEnabled : System.Diagnostics.Tracing.EventLevel * System.Diagnostics.Tracing.EventKeywords * System.Diagnostics.Tracing.EventChannel -> bool
Public Function IsEnabled (level As EventLevel, keywords As EventKeywords, channel As EventChannel) As Boolean

参数

level
EventLevel

要检查的事件级别。The event level to check. 当事件源的级别大于或等于 level 时,将其视为已启用。An event source will be considered enabled when its level is greater than or equal to level.

keywords
EventKeywords

要检查的事件关键字。The event keywords to check.

channel
EventChannel

要检查的事件通道。The event channel to check.

返回

Boolean

如果对指定的事件级别、关键字和通道启用了事件源,则为 true;否则为 falsetrue if the event source is enabled for the specified event level, keywords and channel; otherwise, false.

通过此方法的结果仅可大概了解特定的事件是否处于活动状态。The result of this method is only an approximation of whether a particular event is active. 使用它可避免在禁用了记录的情况下因记录造成昂贵的计算费用。Use it to avoid expensive computation for logging when logging is disabled. 事件源可能具有确定其活动的其他筛选。Event sources may have additional filtering that determines their activity.

注解

如果你的设备不支持If the

适用于