2using System.Collections.Generic;
3using System.Threading.Tasks;
12 private Dictionary<string, Statistic> perActor =
new Dictionary<string, Statistic>();
13 private Dictionary<string, Statistic> perEventId =
new Dictionary<string, Statistic>();
14 private Dictionary<string, Statistic> perFacility =
new Dictionary<string, Statistic>();
15 private Dictionary<string, Statistic> perModule =
new Dictionary<string, Statistic>();
16 private Dictionary<string, Statistic> perLevel =
new Dictionary<string, Statistic>();
17 private Dictionary<string, Statistic> perType =
new Dictionary<string, Statistic>();
18 private Dictionary<string, Statistic> perStackTrace =
new Dictionary<string, Statistic>();
19 private DateTime lastStat = DateTime.MinValue;
20 private readonly
object synchObj =
new object();
29 this.lastStat = DateTime.Now;
39 DateTime TP = DateTime.Now;
45 PerActor = this.perActor,
46 PerEventId = this.perEventId,
47 PerFacility = this.perFacility,
48 PerModule = this.perModule,
49 PerLevel = this.perLevel,
50 PerType = this.perType,
51 PerStackTrace = this.perStackTrace,
52 LastStat = this.lastStat,
56 this.perActor =
new Dictionary<string, Statistic>();
57 this.perEventId =
new Dictionary<string, Statistic>();
58 this.perFacility =
new Dictionary<string, Statistic>();
59 this.perModule =
new Dictionary<string, Statistic>();
60 this.perLevel =
new Dictionary<string, Statistic>();
61 this.perType =
new Dictionary<string, Statistic>();
62 this.perStackTrace =
new Dictionary<string, Statistic>();
79 this.IncLocked(
Event.
Type.ToString(),
this.perType);
80 this.IncLocked(
Event.
Level.ToString(),
this.perLevel);
83 this.IncLocked(s, this.perActor);
86 this.IncLocked(s, this.perEventId);
89 this.IncLocked(s, this.perFacility);
92 this.IncLocked(s, this.perModule);
101 return Task.CompletedTask;
104 private void IncLocked(
string Key, Dictionary<string, Statistic> PerKey)
106 if (PerKey.TryGetValue(Key, out
Statistic Nr))
Class representing an event.
EventType Type
Type of event.
EventLevel Level
Event Level.
string Actor
Actor responsible for the action causing the event.
string Module
Module where the event is reported.
string EventId
Computer-readable Event ID identifying type of even.
string Facility
Facility can be either a facility in the network sense or in the system sense.
string StackTrace
Stack Trace of event.
Base class for event sinks.
virtual string ObjectID
Object ID, used when logging events.
Contains event statistics.
Calculates statistics on incoming events.
override Task Queue(Event Event)
Queues an event to be output.
EventStatisticsSink(string ObjectID)
Calculates statistics on incoming events.
EventStatistics GetStatisticsSinceLast()
Gets statistics of events logged since last call to GetStatisticsSinceLast.
Contains statistical information about one item.