PluralKit/PluralKit.Bot/PKPerformanceEventListener.cs

20 lines
679 B
C#
Raw Normal View History

2019-12-23 13:44:20 +00:00
using System;
using System.Diagnostics.Tracing;
using System.Linq;
namespace PluralKit.Bot {
class PKPerformanceEventListener: EventListener
{
public PKPerformanceEventListener()
{
foreach (var s in EventSource.GetSources())
EnableEvents(s, EventLevel.Informational);
}
protected override void OnEventWritten(EventWrittenEventArgs eventData)
{
base.OnEventWritten(eventData);
2019-12-23 14:49:51 +00:00
// Console.WriteLine($"{eventData.EventSource.Name}/{eventData.EventName}: {string.Join(", ", eventData.PayloadNames.Zip(eventData.Payload).Select(v => $"{v.First}={v.Second}" ))}");
2019-12-23 13:44:20 +00:00
}
}
}