serilog-aspnetcore
serilog-aspnetcore copied to clipboard
Register new Logger instance with DI
If UseSerilog() is used to register a configured logger so that it resolves to Microsoft.Extensions.Logging.ILogger<T>, then what is the recommended way to re-register it once the application is running and a new configured logger is used to replace the existing one? I am dynamically building a new logger since I also need to change source context overrides at any given point.
Hi! Check out https://github.com/nblumhardt/serilog-reload for an example project showing how this might be done. Still uncertain how/when this will be integrated into Serilog.AspNetCore, but considering it for .NET 5.
This is covered by: https://github.com/serilog/serilog-extensions-hosting/pull/28