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

LoupeLoggerProvider misses AgentConfiguration callback #53

Open
ladeak opened this issue Nov 25, 2019 · 3 comments
Open

LoupeLoggerProvider misses AgentConfiguration callback #53

ladeak opened this issue Nov 25, 2019 · 3 comments

Comments

@ladeak
Copy link

ladeak commented Nov 25, 2019

Using ServicesExtensions.AddLoupe(...,...) with the callback let users to customize the configuration.

On the other side, LoupeLoggerProvider depends on IConfiguration and binds the again, hence all changes made in the callback are 'lost'.

Should LoupeLoggerProvider depend on of the IOptions<AgentConfiguration> instead?

@kendallmiller
Copy link
Member

Good input, we'll review and understand what the impact of this. I definitely like the idea of streamlining this!

@ThatRendle
Copy link
Contributor

So the problem here is that LoupeLoggerProvider can be hooked up from the WebHostBuilder to start logging before the Startup class has even been created, which means the callback-configured options are not there.

The obvious fix is to add an Action<AgentConfiguration> callback parameter to ILoggingBuilder.AddLoupe so that programmatic configuration can be done there too.

BUT.

Having provided that callback at the logging.AddLoupe point, developer Alice might reasonably assume that she has now configured Loupe and shouldn't have to do it again.

However, developer Bob might want a different callback for metrics vs logging.

So my thinking is, add the callback to logging.AddLoupe, keep hold of it internally (in a static field somewhere) and use it again in services.AddLoupe if no callback is provided there.

Thoughts, @kendallmiller?

@kendallmiller
Copy link
Member

I see the challenge. As part of making some adjustments to work better directly with IHostBuilder lets see if we can fit this in...

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

No branches or pull requests

3 participants