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

Expose RequestLogging-related dependency registration as a separate method #213

Open
julealgon opened this issue Oct 21, 2020 · 1 comment

Comments

@julealgon
Copy link

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.

@nblumhardt
Copy link
Member

Hi @julealgon - thanks for the suggestion! Post-.NET 5.0 I'll take a look at this - in the meantime I think we will want to stay close to the host builder in the expectation that host-level logging is going through some churn and we may need to hook into it more deeply in the future.

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

No branches or pull requests

2 participants