Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use IExternalScopeProvider for logging scopes #54

Closed
epawlik opened this issue Jan 22, 2021 · 4 comments
Closed

Use IExternalScopeProvider for logging scopes #54

epawlik opened this issue Jan 22, 2021 · 4 comments

Comments

@epawlik
Copy link

epawlik commented Jan 22, 2021

The default logger factory can provide a scope implementation via the ISupportExternalScope and IExternalScopeProvider interfaces.

For reference, see:
Microsoft.Extensions.Logging/LoggerFactory.cs and Microsoft.Extensions.Logging/LoggerFactoryScopeProvider.cs

This gets you features like dotnet/runtime#34305 when using the default logger factory instance.

Can support be added for ISupportExternalScope and IExternalScopeProvider?

@mattwcole
Copy link
Owner

Hi, apologies for the delay getting back to you. This looks useful, thanks. If you would like support added sooner rather than later feel free to put up a pull request, otherwise I'll take a look when I have some time.

@MichalSznajder
Copy link

Just for reference: this relates to getting SpanId, TraceId, ParentId fields in your logs.

@MichalSznajder
Copy link

FYI Probably it should be possible to fake it with approach from serilog/serilog-aspnetcore#207 (comment) and adding mentioned field in when AdditionalFieldsFactory() is called.

@mattwcole
Copy link
Owner

I finally got around to adding support for this, use v2.3.0-pre2 to give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants