-
Notifications
You must be signed in to change notification settings - Fork 213
Description
Is your feature request related to a problem? Please describe.
Currently, this library exposes a UseSerilogRequestLogging method to be used inside the Configure method, but does not expose a method to add the necessary registrations to the container to make it work properly. Usually, "features" added in Configure should have an equivalent AddX extension to be used inside ConfigureServices so that all required dependencies are registered.
I understand the UseSerilog on IHostBuilder includes those registrations, but that happens somewhere else. Perhaps UseSerilog could call into the same method to register the needed classes.
Describe the solution you'd like
Add a new extension method for IServiceCollection to register the needed types for the request logging logic (for example, DiagnosticContext)
Describe alternatives you've considered
Calling UseSerilog on the IHostBuilder does register the necessary dependencies, but it forces changes on Program.cs for cases where one wants to configure the logger inside Startup.