From cc899b4ddd5327649c7759514861be377c644b00 Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Tue, 7 Dec 2021 01:04:54 +0100 Subject: [PATCH] NLogLogger - Reduce complexity of CreateLogEventInfo --- src/NLog.Extensions.Logging/Logging/NLogLogger.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NLog.Extensions.Logging/Logging/NLogLogger.cs b/src/NLog.Extensions.Logging/Logging/NLogLogger.cs index e008e7b4..2b555d22 100644 --- a/src/NLog.Extensions.Logging/Logging/NLogLogger.cs +++ b/src/NLog.Extensions.Logging/Logging/NLogLogger.cs @@ -52,7 +52,7 @@ public void Log(Microsoft.Extensions.Logging.LogLevel logLevel, EventId private LogEventInfo CreateLogEventInfo(LogLevel nLogLogLevel, EventId eventId, TState state, Exception exception, Func formatter) { - if ((_options.CaptureMessageTemplates || _options.CaptureMessageProperties) && state is IReadOnlyList> messagePropertyList) + if (_options.CaptureMessageProperties && state is IReadOnlyList> messagePropertyList) { if (_options.CaptureMessageTemplates) { @@ -181,7 +181,7 @@ private static bool AllParameterCorrectlyPositionalMapped(NLogMessageParameterLi for (int i = 0; i < messageTemplateParameters.Count; ++i) { - if (!messageParameters[i].Name.Equals(messageTemplateParameters[i].Name)) + if (!messageParameters[i].Name.Equals(messageTemplateParameters[i].Name, StringComparison.Ordinal)) { return false; } @@ -204,7 +204,7 @@ private static object[] CreateStructuredLogEventInfoParameters(NLogMessageParame bool extraProperty = true; for (int j = startPos; j < messageTemplateParameters.Count; ++j) { - if (propertyName.Equals(messageTemplateParameters[j].Name)) + if (propertyName.Equals(messageTemplateParameters[j].Name, StringComparison.Ordinal)) { extraProperty = false; paramsArray[j] = messageParameters[i].Value;