Skip to content

Commit

Permalink
altered logging logic to avoid unneeded alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshLozensky committed Jun 4, 2024
1 parent 969eabd commit a78d894
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -760,15 +760,15 @@ internal static void WriteJwsPayload(
if (!audienceChecked && kvp.Key.Equals(JwtRegisteredClaimNames.Aud, StringComparison.Ordinal))
{
audienceChecked = true;
if (audienceSet)
if (audienceSet && LogHelper.IsEnabled(EventLogLevel.Informational))
{
string descriptorMemberName = null;
if (!tokenDescriptor.Audiences.IsNullOrEmpty())
descriptorMemberName = nameof(tokenDescriptor.Audiences);
else if (!string.IsNullOrEmpty(tokenDescriptor.Audience))
descriptorMemberName = nameof(tokenDescriptor.Audience);
if (LogHelper.IsEnabled(EventLogLevel.Informational))
LogHelper.LogInformation(LogHelper.FormatInvariant(LogMessages.IDX14113, LogHelper.MarkAsNonPII(descriptorMemberName)));

LogHelper.LogInformation(LogHelper.FormatInvariant(LogMessages.IDX14113, LogHelper.MarkAsNonPII(descriptorMemberName)));

continue;
}
Expand Down

0 comments on commit a78d894

Please sign in to comment.