Skip to content

Instantly share code, notes, and snippets.

@chrisnas
Created December 6, 2018 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisnas/26f2476b9ae2d4bbe8ae26880208afd8 to your computer and use it in GitHub Desktop.
Save chrisnas/26f2476b9ae2d4bbe8ae26880208afd8 to your computer and use it in GitHub Desktop.
// from https://blogs.msdn.microsoft.com/dotnet/2018/12/04/announcing-net-core-2-2/
// Called whenever an event is written.
protected override void OnEventWritten(EventWrittenEventArgs eventData)
{
// Write the contents of the event to the console.
Console.WriteLine($"ThreadID = {eventData.OSThreadId} ID = {eventData.EventId} Name = {eventData.EventName}");
for (int i = 0; i < eventData.Payload.Count; i++)
{
string payloadString = eventData.Payload[i] != null ? eventData.Payload[i].ToString() : string.Empty;
Console.WriteLine($" Name = \"{eventData.PayloadNames[i]}\" Value = \"{payloadString}\"");
}
Console.WriteLine("\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment