I'm trying to attach a listener to a running process which uses an EventSource
to trace processing events. I've gotten as far as creating my own listener by inheriting from EventListener
and (presumably) need to call EnableEvents
to begin receiving information.
The first argument to all the overloads is the EventSource
to configure and send messages from, but I am unclear how to compose that instance when it needs to identify a source of events in the external process.
I'm just knocking this together as a proof-of-concept, so the code runs in a Console application and the TestEventListener
just tries to write the event to the Console window.
EventSource source = null;
using (var listener = new TestEventListener())
{
listener.EnableEvents(source, EventLevel.Verbose);
Console.ReadKey();
}