C#C
C#3y ago
qqdev

✅ Scoped-based logging: Microsoft interface

Hi! We are planning to make use of scoped-based logging.

using var scope1 = _logger.BeginScope(context.ToDictionary());
logContextInfomation.Foo = bar;
using var scope2 = _logger.BeginScope(context.ToDictionary());

We are not quite happy with this approach tho ^

Is there a less repetitive solution for this? We just want to apply the current context to every log message.

Thanks in advance!
Was this page helpful?