feat: more log context
This commit is contained in:
parent
4047df8610
commit
7749c9d9e2
21 changed files with 159 additions and 15 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using Remora.Discord.API.Abstractions.Gateway.Events;
|
||||
using Remora.Discord.API.Abstractions.Objects;
|
||||
using Remora.Rest.Core;
|
||||
using Serilog.Context;
|
||||
|
||||
|
|
@ -19,7 +20,13 @@ public static class LogUtils
|
|||
("ChannelId", md.ChannelID),
|
||||
("MessageId", md.ID)
|
||||
),
|
||||
IMessageUpdate mc => PushProperties(
|
||||
IMessageUpdate mu => PushProperties(
|
||||
type,
|
||||
("GuildId", mu.GuildID),
|
||||
("ChannelId", mu.ChannelID),
|
||||
("MessageId", mu.ID)
|
||||
),
|
||||
IMessageCreate mc => PushProperties(
|
||||
type,
|
||||
("GuildId", mc.GuildID),
|
||||
("ChannelId", mc.ChannelID),
|
||||
|
|
@ -31,6 +38,93 @@ public static class LogUtils
|
|||
("ChannelId", mdb.ChannelID),
|
||||
("MessageIds", mdb.IDs)
|
||||
),
|
||||
IGuildRoleCreate grc => PushProperties(
|
||||
type,
|
||||
("GuildId", grc.GuildID),
|
||||
("RoleId", grc.Role.ID)
|
||||
),
|
||||
IGuildRoleUpdate gru => PushProperties(
|
||||
type,
|
||||
("GuildId", gru.GuildID),
|
||||
("RoleId", gru.Role.ID)
|
||||
),
|
||||
IGuildRoleDelete grd => PushProperties(
|
||||
type,
|
||||
("GuildId", grd.GuildID),
|
||||
("RoleId", grd.RoleID)
|
||||
),
|
||||
IGuildMemberAdd gma => PushProperties(
|
||||
type,
|
||||
("GuildId", gma.GuildID),
|
||||
("UserId", gma.User.Map(u => u.ID))
|
||||
),
|
||||
IGuildMemberUpdate gmu => PushProperties(
|
||||
type,
|
||||
("GuildId", gmu.GuildID),
|
||||
("UserId", gmu.User.ID)
|
||||
),
|
||||
IGuildMemberRemove gmr => PushProperties(
|
||||
type,
|
||||
("GuildId", gmr.GuildID),
|
||||
("UserId", gmr.User.ID)
|
||||
),
|
||||
IInviteCreate ic => PushProperties(
|
||||
type,
|
||||
("GuildId", ic.GuildID),
|
||||
("ChannelId", ic.ChannelID),
|
||||
("InviteCode", ic.Code)
|
||||
),
|
||||
IInviteDelete id => PushProperties(
|
||||
type,
|
||||
("GuildId", id.GuildID),
|
||||
("ChannelId", id.ChannelID),
|
||||
("Code", id.Code)
|
||||
),
|
||||
IChannelCreate cc => PushProperties(
|
||||
type,
|
||||
("GuildId", cc.GuildID),
|
||||
("ChannelId", cc.ID)
|
||||
),
|
||||
IChannelUpdate cu => PushProperties(
|
||||
type,
|
||||
("GuildId", cu.GuildID),
|
||||
("ChannelId", cu.ID)
|
||||
),
|
||||
IChannelDelete cd => PushProperties(
|
||||
type,
|
||||
("GuildId", cd.GuildID),
|
||||
("ChannelId", cd.ID)
|
||||
),
|
||||
IGuildAuditLogEntryCreate ale => PushProperties(
|
||||
type,
|
||||
("GuildId", ale.GuildID),
|
||||
("AuditLogEntryId", ale.ID),
|
||||
("ActionType", ale.ActionType)
|
||||
),
|
||||
IGuildBanAdd gba => PushProperties(
|
||||
type,
|
||||
("GuildId", gba.GuildID),
|
||||
("UserId", gba.User.ID)
|
||||
),
|
||||
IGuildBanRemove gbr => PushProperties(
|
||||
type,
|
||||
("GuildId", gbr.GuildID),
|
||||
("UserId", gbr.User.ID)
|
||||
),
|
||||
IGuildCreate gc => PushProperties(
|
||||
type,
|
||||
("GuildId", gc.Guild.Match(g => g.ID, g => g.ID))
|
||||
),
|
||||
IGuildDelete gd => PushProperties(type, ("GuildId", gd.ID)),
|
||||
IGuildEmojisUpdate geu => PushProperties(type, ("GuildId", geu.GuildID)),
|
||||
IGuildMembersChunk gmc => PushProperties(
|
||||
type,
|
||||
("GuildId", gmc.GuildID),
|
||||
("MemberCount", gmc.Members.Count),
|
||||
("ChunkIndex", gmc.ChunkIndex),
|
||||
("ChunkCount", gmc.ChunkCount)
|
||||
),
|
||||
IGuildUpdate gu => PushProperties(type, ("GuildId", gu.ID)),
|
||||
_ => PushProperties(type),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue