Try logging *literally everything*
This commit is contained in:
parent
f2ce09d467
commit
5448f734d4
@ -53,7 +53,6 @@ namespace PluralKit.Bot
|
|||||||
|
|
||||||
using (Sentry.SentrySdk.Init(coreConfig.SentryUrl))
|
using (Sentry.SentrySdk.Init(coreConfig.SentryUrl))
|
||||||
{
|
{
|
||||||
|
|
||||||
logger.Information("Connecting to database");
|
logger.Information("Connecting to database");
|
||||||
using (var conn = await services.GetRequiredService<DbConnectionFactory>().Obtain())
|
using (var conn = await services.GetRequiredService<DbConnectionFactory>().Obtain())
|
||||||
await Schema.CreateTables(conn);
|
await Schema.CreateTables(conn);
|
||||||
@ -144,9 +143,11 @@ namespace PluralKit.Bot
|
|||||||
private IMetrics _metrics;
|
private IMetrics _metrics;
|
||||||
private PeriodicStatCollector _collector;
|
private PeriodicStatCollector _collector;
|
||||||
private ILogger _logger;
|
private ILogger _logger;
|
||||||
|
private PKPerformanceEventListener _pl;
|
||||||
|
|
||||||
public Bot(IServiceProvider services, IDiscordClient client, IMetrics metrics, PeriodicStatCollector collector, ILogger logger)
|
public Bot(IServiceProvider services, IDiscordClient client, IMetrics metrics, PeriodicStatCollector collector, ILogger logger)
|
||||||
{
|
{
|
||||||
|
_pl = new PKPerformanceEventListener();
|
||||||
_services = services;
|
_services = services;
|
||||||
_client = client as DiscordShardedClient;
|
_client = client as DiscordShardedClient;
|
||||||
_metrics = metrics;
|
_metrics = metrics;
|
||||||
|
20
PluralKit.Bot/PKPerformanceEventListener.cs
Normal file
20
PluralKit.Bot/PKPerformanceEventListener.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
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);
|
||||||
|
Console.WriteLine($"{eventData.EventSource.Name}/{eventData.EventName}: {string.Join(", ", eventData.PayloadNames.Zip(eventData.Payload).Select(v => $"{v.First}={v.Second}" ))}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user