2using System.Collections.Generic;
4using System.Threading.Tasks;
18 private readonly
object synchObject =
new object();
19 private bool disposed =
false;
66 return Task.CompletedTask;
68 lock (this.synchObject)
73 if (!(this.output is
null))
76 this.output.Write(
", ");
78 this.output.Write(
'\t');
80 this.output.Write(
'\t');
85 this.output.Write(
'\t');
91 this.output.Write(
'\t');
97 this.output.Write(
'\t');
101 this.output.WriteLine(
"\r\n");
105 this.output.Write(
'\t');
111 this.output.Write(
'\t');
117 this.output.WriteLine(
"\r\n");
119 foreach (KeyValuePair<string, object> Tag
in Event.
Tags)
121 this.output.Write(
'\t');
122 this.output.Write(Tag.Key);
123 this.output.Write(
'=');
125 if (!(Tag.Value is
null))
126 this.output.Write(Tag.Value.ToString());
130 this.output.WriteLine(
"\r\n");
135 this.output.WriteLine(
"\r\n");
159 return Task.CompletedTask;
172 if (this.CanDisposeOutput)
174 this.output?.Flush();
175 this.output?.Dispose();
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.
string StackTrace
Stack Trace of event.
Base class for event sinks.
Outputs sniffed data to a text writer.
override void Dispose()
IDisposable.Dispose
virtual void DisposeOutput()
Disposes of the current output.
virtual void BeforeWrite()
Method is called before writing something to the text file.
virtual void AfterWrite()
Method is called after writing something to the text file.
TextWriterEventSink(string ObjectID, TextWriter Output)
Outputs sniffed data to a text writer.
TextWriter output
Text writer object.
override Task Queue(Event Event)
Queues an event to be output.
virtual bool CanDisposeOutput
If output can be disposed.
virtual string ObjectID
Object ID, used when logging events.