4using System.Threading.Tasks;
18 private readonly
object synchObject =
new object();
19 private bool disposed =
false;
57 return base.DisposeAsync();
67 return Task.CompletedTask;
69 lock (this.synchObject)
74 if (!(this.output is
null))
77 this.output.Write(
", ");
79 this.output.Write(
'\t');
81 this.output.Write(
'\t');
86 this.output.Write(
'\t');
92 this.output.Write(
'\t');
98 this.output.Write(
'\t');
102 this.output.WriteLine(
"\r\n");
106 this.output.Write(
'\t');
112 this.output.Write(
'\t');
118 this.output.WriteLine(
"\r\n");
120 foreach (KeyValuePair<string, object> Tag
in Event.
Tags)
122 this.output.Write(
'\t');
123 this.output.Write(Tag.Key);
124 this.output.Write(
'=');
126 if (!(Tag.Value is
null))
127 this.output.Write(Tag.Value.ToString());
131 this.output.WriteLine(
"\r\n");
136 this.output.WriteLine(
"\r\n");
160 return Task.CompletedTask;
173 if (this.CanDisposeOutput)
175 this.output?.Flush();
176 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.
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 DisposeAsync()
IDisposableAsync.DisposeAsync
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.