Closed Leon99 closed 9 months ago
Hi! There's a UseSerilog()
overload that accepts a callback, providing access to configuration etc., so I think it should support what you're looking for.
For an explanation and discussion of the differences between these packages check out
HTH, and feedback on how to present this in the README still very welcome :+1:
Thanks Nick. Those pages explain how to set up Serilog.Extensions.Hosting/Serilog.AspNetCore but there's no direct comparison with Serilog.Extensions.Logging. From what I understood so far, Serilog.Extensions.Logging just adds Serilog as an additional logging provider for the built-in logging, but Serilog.Extensions.Hosting/Serilog.AspNetCore fully replaces it, does that sound right?
As for the configuration, I need to be able to use Seq based on the configuration setting and preserve the built-in logging configuration and behaviour. The Seq logging provider doesn't support enrichments, so I have to use full Serilog.
From what I understood so far, Serilog.Extensions.Logging just adds Serilog as an additional logging provider for the built-in logging, but Serilog.Extensions.Hosting/Serilog.AspNetCore fully replaces it, does that sound right?
Yes, that's correct.
he Seq logging provider doesn't support enrichments, so I have to use full Serilog.
Could be one for us to think more about - thanks!
Closing this one as stale. Hope all's going well, Leon 👋
The readme mentions that serilog-aspnetcore should be used for .NET Core 2.0+ but doesn't explain the reasons. Furthermore, later it mentions configuration steps required specifically for .NET Core 2.0+ which makes it more confusing.
From reading serilog-aspnetcore's readme, it looks like it's actually worse as it can't be configured conditionally based on configuration settings as it's not available during host building. UseSerilogRequestLogging(), on the other hand, seems to be a useful addition. Anything else? It'd be great to have a clear comparison between the packages right in the readme.