mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: add cluster ID to Serilog enricher
This commit is contained in:
parent
a507883dda
commit
dfc9f8fcfb
1 changed files with 6 additions and 1 deletions
|
|
@ -11,17 +11,22 @@ public class SerilogGatewayEnricherFactory
|
||||||
{
|
{
|
||||||
private readonly Bot _bot;
|
private readonly Bot _bot;
|
||||||
private readonly IDiscordCache _cache;
|
private readonly IDiscordCache _cache;
|
||||||
|
private readonly BotConfig _botConfig;
|
||||||
|
|
||||||
public SerilogGatewayEnricherFactory(Bot bot, IDiscordCache cache)
|
public SerilogGatewayEnricherFactory(Bot bot, IDiscordCache cache, BotConfig botConfig)
|
||||||
{
|
{
|
||||||
_bot = bot;
|
_bot = bot;
|
||||||
_cache = cache;
|
_cache = cache;
|
||||||
|
_botConfig = botConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ILogEventEnricher> GetEnricher(Shard shard, IGatewayEvent evt)
|
public async Task<ILogEventEnricher> GetEnricher(Shard shard, IGatewayEvent evt)
|
||||||
{
|
{
|
||||||
var props = new List<LogEventProperty> { new("ShardId", new ScalarValue(shard.ShardId)) };
|
var props = new List<LogEventProperty> { 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 (guild, channel) = GetGuildChannelId(evt);
|
||||||
var user = GetUserId(evt);
|
var user = GetUserId(evt);
|
||||||
var message = GetMessageId(evt);
|
var message = GetMessageId(evt);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue