EventKeywords 枚举

定义

定义应用于事件的标准关键字。

此枚举支持其成员值的按位组合。

C#
[System.Flags]
public enum EventKeywords
继承
EventKeywords
属性

字段

名称 说明
All -1

所有位设为 1,表示每个可能的事件组。

AuditFailure 4503599627370496

已附加到所有失败的安全审核事件。 仅对安全日志中的事件使用此关键字。

AuditSuccess 9007199254740992

已附加到所有成功的安全审核事件。 仅对安全日志中的事件使用此关键字。

CorrelationHint 4503599627370496

已附加到传输事件,其中相关的活动 ID(相关 ID)是一个计算值,不能保证其唯一性(即它不是真正的 GUID)。

EventLogClassic 36028797018963968

附加到使用 RaiseEvent 函数引发的事件。

MicrosoftTelemetry 562949953421312

已附加到所有 Microsoft 遥测事件。

None 0

发布此事件时未对关键字执行任何筛选。

Sqm 2251799813685248

已附加到所有服务质量机制 (SQM) 事件。

WdiContext 562949953421312

已附加到所有 Windows 诊断基础结构 (WDI) 上下文事件。

WdiDiagnostic 1125899906842624

已附加到所有 Windows 诊断基础结构 (WDI) 诊断事件。

示例

以下示例演示如何使用 EventKeywords 类重新定义事件关键字。 此代码示例是为 EventSource 类提供的一个更大示例的一部分。

C#
public static class Keywords
{
    public const EventKeywords Page = (EventKeywords)1;
    public const EventKeywords DataBase = (EventKeywords)2;
    public const EventKeywords Diagnostic = (EventKeywords)4;
    public const EventKeywords Perf = (EventKeywords)8;
}

注解

可以通过为标志分配不同的名称来自定义关键字 (keyword) 的含义。

适用于

产品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 2.0, 2.1
UWP 10.0