From e556cc71fa94b4aa37098d1c0d5dc11f3c435915 Mon Sep 17 00:00:00 2001 From: Ske Date: Thu, 27 Aug 2020 14:40:49 +0200 Subject: [PATCH] Add persistent event ID to log context --- PluralKit.Bot/Bot.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PluralKit.Bot/Bot.cs b/PluralKit.Bot/Bot.cs index c2f02d20..6ccb3e2a 100644 --- a/PluralKit.Bot/Bot.cs +++ b/PluralKit.Bot/Bot.cs @@ -102,12 +102,13 @@ namespace PluralKit.Bot async Task HandleEventInner() { + using var _ = LogContext.PushProperty("EventId", Guid.NewGuid()); + // Mainly for testing ELK volume atm, no-op unless Elastic is configured if (evt is MessageCreateEventArgs mc) using (LogContext.PushProperty("Elastic", "yes?")) _logger.Information("Received event {@Event}", new { - Id = Guid.NewGuid(), Type = mc.GetType().Name.Replace("EventArgs", ""), MessageId = mc.Message.Id, ChannelId = mc.Channel.Id,