Updates to Elastic logging

This commit is contained in:
Ske
2021-06-10 14:21:05 +02:00
parent ae9ed0f4ee
commit ae82bb4168
18 changed files with 150 additions and 97 deletions

View File

@@ -9,6 +9,7 @@ using Myriad.Serialization;
using Myriad.Types;
using Serilog;
using Serilog.Context;
namespace Myriad.Gateway
{
@@ -50,7 +51,7 @@ namespace Myriad.Gateway
_info = info;
_ratelimiter = ratelimiter;
_url = url;
_logger = logger;
_logger = logger.ForContext<Shard>().ForContext("ShardId", info.ShardId);
_stateManager = new ShardStateManager(info, _jsonSerializerOptions, logger)
{
HandleEvent = HandleEvent,
@@ -70,6 +71,9 @@ namespace Myriad.Gateway
private async Task ShardLoop()
{
// may be superfluous but this adds shard id to ambient context which is nice
using var _ = LogContext.PushProperty("ShardId", _info.ShardId);
while (true)
{
try