1using System.Collections.Generic;
3using System.Threading.Tasks;
12 private const int TabWidth = 8;
18 : base(
"Debug Event Sink")
27 StringBuilder Output =
new StringBuilder();
33 Output.Append(
"DEBUG: ");
37 Output.Append(
"INFO: ");
41 Output.Append(
"NOTICE: ");
45 Output.Append(
"WARNING: ");
49 Output.Append(
"ERROR: ");
53 Output.Append(
"CRITICAL: ");
57 Output.Append(
"ALERT: ");
61 Output.Append(
"EMERGENCY: ");
76 foreach (
string Part
in Parts)
82 i = Output.ToString().Length % TabWidth;
83 Output.Append(
new string(
' ', TabWidth - i));
95 this.AddTag(Output,
"Timestamp",
Event.
Timestamp.ToString(),
true);
96 this.AddTag(Output,
"Level",
Event.
Level.ToString(),
false);
102 this.AddTag(Output,
"Actor",
Event.
Actor,
false);
108 this.AddTag(Output,
"Module",
Event.
Module,
false);
112 foreach (KeyValuePair<string, object> P
in Event.
Tags)
113 this.AddTag(Output, P.Key, P.Value,
false);
118 System.Diagnostics.Debug.WriteLine(Output.ToString());
120 return Task.CompletedTask;
123 private void AddTag(StringBuilder Output,
string Key,
object Value,
bool First)
130 Output.Append(Value);
Outputs events to the console standard output.
override Task Queue(Event Event)
IEventSink.Queue
DebugEventSink()
Outputs events to the console standard output.
Class representing an event.
string Message
Free-text event message.
EventType Type
Type of event.
string Object
Object related to the event.
EventLevel Level
Event Level.
string Actor
Actor responsible for the action causing the event.
string Module
Module where the event is reported.
DateTime Timestamp
Timestamp of event.
KeyValuePair< string, object >[] Tags
Variable set of tags providing event-specific information.
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.
Base class for event sinks.