-
Notifications
You must be signed in to change notification settings - Fork 0
/
EventIDs.cs
103 lines (85 loc) · 2.63 KB
/
EventIDs.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Tuning_Logging_Levels
{
/// <summary>
/// Categories of events suitable for the Event Log
/// </summary>
public enum EventCategory
{
NotSet = 0,
Generic = 1,
PageGeneration = 2,
MessageQueueing = 3,
// ...
Reserved = 1000
}
/// <summary>
/// The set of possible, known events in the system, including unknown
/// </summary>
public enum EventID
{
// Badly-initialised logging data
NotSet = 0,
// An unrecognised event has occurred
UnexpectedError = 1000,
#region Generic Events [1000 -> 1999]
ApplicationStarted = 1001,
ApplicationShutdownNoticeReceived = 1002,
#endregion
#region Page Generation Events [2000 -> 2999]
PageGenerationStarted = 2000,
PageGenerationCompleted = 2001,
PageGenerationHTMLFragmentCacheHit = 2002,
PageGenerationHTMLFragmentCacheMiss = 2003,
#endregion
#region Message Queueing Events [3000 -> 3999]
MessageQueued = 3000,
MessagePeeked = 3001,
MessagePopped = 3002,
MessageMissing = 3003,
MessageCopied = 3004,
#endregion
// ...
}
/// <summary>
/// Helps to resolve Event Categories based on Event Type
/// </summary>
public class EventCategoryHelper
{
/// <summary>
/// Returns the event category for the given event type
/// </summary>
/// <param name="eventType">The EventType whose Category is needed</param>
/// <returns>The category for the given event type</returns>
public static EventCategory ResolveEventCategory(EventID eventType)
{
EventCategory result = EventCategory.NotSet;
int eventTypeInt = (int)eventType;
if (eventTypeInt < 1000)
{
result = EventCategory.NotSet;
}
else if (eventTypeInt < 2000)
{
result = EventCategory.Generic;
}
else if (eventTypeInt < 3000)
{
result = EventCategory.PageGeneration;
}
else if (eventTypeInt < 4000)
{
result = EventCategory.MessageQueueing;
}
// ...
else
{
result = EventCategory.Reserved;
}
return result;
}
}
}