Skip to content

Commit 8fb3621

Browse files
authored
NLogLogger - Reduce complexity of CreateLogEventInfo (#559)
1 parent bb81429 commit 8fb3621

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/NLog.Extensions.Logging/Logging/NLogLogger.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void Log<TState>(Microsoft.Extensions.Logging.LogLevel logLevel, EventId
5252

5353
private LogEventInfo CreateLogEventInfo<TState>(LogLevel nLogLogLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
5454
{
55-
if ((_options.CaptureMessageTemplates || _options.CaptureMessageProperties) && state is IReadOnlyList<KeyValuePair<string, object>> messagePropertyList)
55+
if (_options.CaptureMessageProperties && state is IReadOnlyList<KeyValuePair<string, object>> messagePropertyList)
5656
{
5757
if (_options.CaptureMessageTemplates)
5858
{
@@ -181,7 +181,7 @@ private static bool AllParameterCorrectlyPositionalMapped(NLogMessageParameterLi
181181

182182
for (int i = 0; i < messageTemplateParameters.Count; ++i)
183183
{
184-
if (!messageParameters[i].Name.Equals(messageTemplateParameters[i].Name))
184+
if (!messageParameters[i].Name.Equals(messageTemplateParameters[i].Name, StringComparison.Ordinal))
185185
{
186186
return false;
187187
}
@@ -204,7 +204,7 @@ private static object[] CreateStructuredLogEventInfoParameters(NLogMessageParame
204204
bool extraProperty = true;
205205
for (int j = startPos; j < messageTemplateParameters.Count; ++j)
206206
{
207-
if (propertyName.Equals(messageTemplateParameters[j].Name))
207+
if (propertyName.Equals(messageTemplateParameters[j].Name, StringComparison.Ordinal))
208208
{
209209
extraProperty = false;
210210
paramsArray[j] = messageParameters[i].Value;

0 commit comments

Comments
 (0)