-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
SerilogLoggerFactory and AddProvider() infrastructure #132
Conversation
Be interesting to push this thru the pipe to flush any performance implications. Should be minimal as it is representative of another sink. |
Thanks for the 👀, @merbla. I don't think it's ready for wider consumption just yet, there are a few things to hash out (such as how to make sure the I'll have to look into whether named loggers are worth caching - not sure what the default factory does, here, but if they're cached it could turn out that providers rely on this don't optimize for frequent logger creation. A pretty good chance this will be a perf bottleneck. |
I've got this to a point now where it works with the default And with the NReco.Logging.File
(The sample program produces a very ugly set of logs, it goes waaay back, now - we should probably update it to something more instructive :-D ) Next up, I will:
|
See e.g.: opentracing-contrib/csharp-netcore#42 |
Here's how the OpenTracing contrib provider uses the values passed in via We should preserve the |
…-* and limit dependencies
Turns out we were already using There are a lot of perf gains to make, but I think this is ready to go through the wringer now to see where/how it breaks or falls short. Marked as |
@serilog/reviewers-core anyone keen to dig in? :-) |
factory.AddProvider(provider); | ||
|
||
return factory; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This provider registration functionality would need to be wrapped up by UseSerilog()
in the two alternative hosting projects.
If no one has time to get up to speed with this, I think we'd be best off sending it to Any concerns, let me know, otherwise I'll YOLO it through in a day or two :-) |
For #130
The
Sample
project uses the newLoggerProviderCollection
/WriteTo.Providers()
mechanism to send events back through dynamically-added providers, and providers registered in IoC.If you run it you'll see interleaved madness, because the two console sinks aren't synchronized (not really a realistic use case):
Commenting out the Serilog console sink, you'll see what we end up with from the MEL console provider:
And commenting out
AddConsole()
will get you just Serilog's sink:A lot is sketchy/TODO (too much to list here!), but - every log event raised through any interface, both Serilog loggers and MEL loggers, goes through the exact same (Serilog) pipeline, uses the same level controls and filters, and ends up at the same sinks/providers.
Ergonomics should be able to be improved at a higher level, in packages like
Serilog.AspNetCore
/the hosting equivalent.