getsentry / getsentry/sentry-dotnet
feat: support `BeginScope` of `Microsoft.Extensions.Logging` for Structured Logs
- Dominant language
- C#
- Stars
- 770
- Forks
- 248
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 49
Description
### Description
### Summary
Attach _state_
and `FormattedLogValues` (`IReadOnlyList>` or `IEnumerable>`)
provided via the `IDisposable`-returning `BeginScope` (instance and extension) methods
as Attributes to Logs.
### Remarks
APIs to support
- [IDisposable? Microsoft.Extensions.Logging.ILogger.BeginScope(TState state) where TState : notnull](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger.beginscope)
- [IDisposable? Microsoft.Extensions.Logging.LoggerExtensions.BeginScope(this ILogger logger, string messageFormat, params object?[] args)](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.loggerextensions.beginscope)
Consider using `Microsoft.Extensions.Logging.IExternalScopeProvider` as implementation detail.
Consider supporting a boolean `IncludeScopes` option, that e.g. the `Console`-Logger exposes.
See docs at [Logging in C# and .NET > Log scopes](https://learn.microsoft.com/dotnet/core/extensions/logging/overview#log-scopes).
Contributor guide
Assessment
This issue has not been assessed yet.