2using System.Threading.Tasks;
14 private static bool terminating =
false;
15 private static bool terminated =
false;
19 Log.Terminating += Log_Terminating;
20 Task.Run(() => PerformWork());
23 private static void Log_Terminating(
object Sender, System.EventArgs e)
26 Log.Terminating -= Log_Terminating;
29 internal static void Terminate()
44 return queue?.
Add(Work) ?? Task.FromResult(
false);
46 return Task.FromResult(
false);
62 private static async
void PerformWork()
68 while (!((Item = await (queue?.Wait() ?? Task.FromResult<
WorkItem>(
null))) is
null))
81 string.Empty,
string.Empty);
85 if (Sink.GetType().FullName.Contains(
".Console"))
Class representing an event.
void Avoid(IEventSink EventSink)
If the event sink EventSink should be avoided when logging the event.
Static class managing the application event log. Applications and services log events on this static ...
static IEventSink[] Sinks
Registered sinks.
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
static EventType GetEventType(Exception Exception)
Gets the event type corresponding to a given exception object.
static Exception UnnestException(Exception Exception)
Unnests an exception, to extract the relevant inner exception.
static async void Event(Event Event)
Logs an event. It will be distributed to registered event sinks.
Processes console tasks, such as input and output, in a serialized asynchronous manner.
static bool Terminated
If the console worker has been terminated.
static Task< bool > Queue(WorkItem Work)
Queues a work item.
static bool Terminating
If the console worker is being terminated.
Manages a Console operation.
void Processed(bool Result)
Flags the item as processed.
abstract Task Execute()
Executes the console operation.
Asynchronous First-in-First-out (FIFO) Queue, for use when transporting items of type T between task...
void Dispose()
IDisposable.Dispose
Task< bool > Add(T Item)
Adds an item last to the queue.
Interface for all event sinks.