From dfc9f8fcfbd71128d8f6c829e0ca0320bdf2d5d0 Mon Sep 17 00:00:00 2001 From: spiral Date: Thu, 13 Jan 2022 12:28:08 -0500 Subject: [PATCH] feat: add cluster ID to Serilog enricher --- PluralKit.Bot/Utils/SerilogGatewayEnricherFactory.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PluralKit.Bot/Utils/SerilogGatewayEnricherFactory.cs b/PluralKit.Bot/Utils/SerilogGatewayEnricherFactory.cs index 47728c1e..942d0881 100644 --- a/PluralKit.Bot/Utils/SerilogGatewayEnricherFactory.cs +++ b/PluralKit.Bot/Utils/SerilogGatewayEnricherFactory.cs @@ -11,17 +11,22 @@ public class SerilogGatewayEnricherFactory { private readonly Bot _bot; private readonly IDiscordCache _cache; + private readonly BotConfig _botConfig; - public SerilogGatewayEnricherFactory(Bot bot, IDiscordCache cache) + public SerilogGatewayEnricherFactory(Bot bot, IDiscordCache cache, BotConfig botConfig) { _bot = bot; _cache = cache; + _botConfig = botConfig; } public async Task GetEnricher(Shard shard, IGatewayEvent evt) { var props = new List { new("ShardId", new ScalarValue(shard.ShardId)) }; + if (_botConfig.Cluster != null) + props.Add(new LogEventProperty("ClusterId", new ScalarValue(_botConfig.Cluster.NodeName))); + var (guild, channel) = GetGuildChannelId(evt); var user = GetUserId(evt); var message = GetMessageId(evt);