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) #2188

Merged
merged 1 commit into from Jul 28, 2023

Conversation

brentschmaltz
Copy link
Member

This is Stephen's PR originally committed into dev7x.
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.

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 brentschmaltz merged commit be6ba72 into dev7 Jul 28, 2023
1 check passed
@brentschmaltz brentschmaltz deleted the brentsch/GuardLoggingCalls branch July 28, 2023 15:56
}
else
{
// Skip the element since it is not an <RSAKeyValue>
LogHelper.LogWarning(LogMessages.IDX30300, reader.ReadOuterXml());
reader.Skip();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like changed behavior. @keegan-caruso @brentschmaltz @jennyf19 assuming no tests are failing, however would be good to assess this change for any potential impact (perhaps not relevant as the reader.ReadEndElement does this implicitly already.

Same comment below.

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.

None yet

5 participants