Skip to content

Commit

Permalink
NLogLogger - Small optimization when message-template syntax is used (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
snakefoot authored Nov 1, 2022
1 parent 75d08ab commit 5a4acaa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/NLog.Extensions.Logging/Logging/NLogLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,13 @@ private static void CaptureLogEventInfoParameters(LogEventInfo logEvent, NLogMes
/// <returns>true if correct</returns>
private static bool AllParameterCorrectlyPositionalMapped(NLogMessageParameterList messageParameters, MessageTemplateParameters messageTemplateParameters)
{
if (messageTemplateParameters.Count != messageParameters.Count)
var messageParameterCount = messageParameters.Count;
if (messageParameterCount != messageTemplateParameters.Count)
{
return false;
}

for (int i = 0; i < messageTemplateParameters.Count; ++i)
for (int i = 0; i < messageParameterCount; ++i)
{
if (!messageParameters[i].Name.Equals(messageTemplateParameters[i].Name, StringComparison.Ordinal))
{
Expand Down

0 comments on commit 5a4acaa

Please sign in to comment.