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

Guard logging calls to avoid unnecessary work at call site #2164

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

stephentoub
Copy link
Collaborator

(Ignore the first commit. It is a copy of the commit from #2161, which this PR then builds on.)

Many LogHelper.Log calls are doing work at the call site, such as allocating params arrays, boxing structs, formatting strings, and so on, even when the data will be thrown away because logging (or logging for that verbosity level) isn't enabled. This adds an IsEnabled method to LogHelper and uses it at any call site where there's such work to be avoided.

Fixes #2163

Copy link
Collaborator

@jennyf19 jennyf19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. We should the same in our other library as well, I think we have a similar issue there.

@keegan-caruso
Copy link
Contributor

@stephentoub merge conflict from #2161

@stephentoub
Copy link
Collaborator Author

merge conflict from #2161

Yup, thanks, fixed. I'd submitted this with the commit from that one, just deleted that first commit here with a rebase.

@jennyf19 jennyf19 added this to the 7.0.0-preview2 milestone Jul 27, 2023
@jennyf19
Copy link
Collaborator

@stephentoub looks like there are still merge conflicts?

@stephentoub
Copy link
Collaborator Author

looks like there are still merge conflicts?

Not "still", but "again" :) I'll fix them again.

@jennyf19
Copy link
Collaborator

looks like there are still merge conflicts?

Not "still", but "again" :) I'll fix them again.

Hard to keep up with you!

@stephentoub
Copy link
Collaborator Author

Conflicts resolved.

@jennyf19
Copy link
Collaborator

@keegan-caruso and @brentschmaltz the tests via the GitHub action is not working properly, or there is a test failure not bubbling up nicely. We will have to test this one locally for now.

@keegan-caruso
Copy link
Contributor

@jennyf19 I don't understand, when I pull this one locally the test run hangs

@jennyf19
Copy link
Collaborator

@jennyf19 I don't understand, when I pull this one locally the test run hangs

That makes sense...But that test doesn't normally hang?

Many LogHelper.Log calls are doing work at the call site, such as allocating params arrays, boxing structs, formatting strings, and so on, even when the data will be thrown away because logging (or logging for that verbosity level) isn't enabled.  This adds an IsEnabled method to LogHelper and uses it at any call site where there's such work to be avoided.
@jennyf19 jennyf19 merged commit 12d2f88 into AzureAD:dev7x Jul 28, 2023
brentschmaltz pushed a commit that referenced this pull request Jul 28, 2023
Many LogHelper.Log calls are doing work at the call site, such as allocating params arrays, boxing structs, formatting strings, and so on, even when the data will be thrown away because logging (or logging for that verbosity level) isn't enabled.  This adds an IsEnabled method to LogHelper and uses it at any call site where there's such work to be avoided.
brentschmaltz pushed a commit that referenced this pull request Jul 28, 2023
Many LogHelper.Log calls are doing work at the call site, such as allocating params arrays, boxing structs, formatting strings, and so on, even when the data will be thrown away because logging (or logging for that verbosity level) isn't enabled.  This adds an IsEnabled method to LogHelper and uses it at any call site where there's such work to be avoided.
brentschmaltz pushed a commit that referenced this pull request Sep 6, 2023
Many LogHelper.Log calls are doing work at the call site, such as allocating params arrays, boxing structs, formatting strings, and so on, even when the data will be thrown away because logging (or logging for that verbosity level) isn't enabled.  This adds an IsEnabled method to LogHelper and uses it at any call site where there's such work to be avoided.
brentschmaltz pushed a commit that referenced this pull request Sep 7, 2023
Many LogHelper.Log calls are doing work at the call site, such as allocating params arrays, boxing structs, formatting strings, and so on, even when the data will be thrown away because logging (or logging for that verbosity level) isn't enabled.  This adds an IsEnabled method to LogHelper and uses it at any call site where there's such work to be avoided.
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

Successfully merging this pull request may close these issues.

5 participants