-
Notifications
You must be signed in to change notification settings - Fork 230
Lazily import ILoggerProviders #10327
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
Lazily import ILoggerProviders #10327
Conversation
This change makes our AbstractLoggerFactory take a set of Lazy<ILoggerProvider> instances and only realize them the first time a message is logged.
How would that work with runtime logging level change? |
Yeah, maybe it couldn't be done. At least, I can't visualize how we'd make output window logger track the log level. I suppose we could make deeper changes to make the runtime log part of the core logger infrastructure. |
davidwengier
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome. In the meeting I was thinking "We'll have to make an ILogger that represents a lazy set of providers", which would be a bunch of work, but turns out we already almost had that!
I wouldn't even be opposed to having specialized interfaces for |
I went ahead and added support for exported |
|
@dotnet/razor-compiler: You shouldn't need to review this PR. The only compiler relevant change I made is to remove an unused method before realizing that it was in the shared library. 😄 |
333fred
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shared code LGTM.
Fixes #10326
This change makes our
AbstractLoggerFactorytake a set ofLazy<ILoggerProvider>instances and only realize them the first time a message is logged.🤔 I wonder if it would be possible to change our
ILoggerProviderinstances to declare their minimumLogLevelvia MEF and import that as metadata? That would allow us to avoid instantiating all the logger providers just to callIsEnabled.