-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Skip null loggers when creating message loggers in Logger factory. #117334
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
Conversation
Tagging subscribers to this area: @dotnet/area-extensions-logging |
src/libraries/Microsoft.Extensions.Logging/src/LoggerFactory.cs
Outdated
Show resolved
Hide resolved
9d7bebf
to
31836e9
Compare
I tried to think how to test this but other than adding InternalsVisibleTo (I assume no no) or reflection (eeh?) I don't see any way... |
Could test the BeginScope optimization specifically.
|
Clever, good idea, added :) |
src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerFactoryTest.cs
Outdated
Show resolved
Hide resolved
src/libraries/Microsoft.Extensions.Logging/src/LoggerFactory.cs
Outdated
Show resolved
Hide resolved
@petrroll please try to not force-push again, this reset the review, and it is hard to tell what has changed since last review. Thanks! |
Are there benchmark numbers? For initialisation of logging, and for ILogger.Log in steady state after the ILogger has been created by LoggerFactory. |
@KalleOlaviNiemitalo do we need that? Creating logger will be marginally worse with especially worse allocations, logging will be faster - but depending on the Perf of any used logger might or might not be dwarfed. It doesn't seem particularly useful. This is clean, relatively simple solution. What would we achieve with it? |
I don't insist on benchmarking this, but if you have done the benchmark, then I am curious to see the numbers. |
I haven't so regrettably I can't share. It was motivated by being annoyed that one of may changes at work could to 20+ loggers that are reach only for one category and noticing other libraries doing similar things. Purely that :) |
/ba-g there is one failure which is looks outage or infra unrelated issue. |
Thanks @petrroll for providing the change. |
No description provided.