Skip to content

Commit

Permalink
NLogLogger - Reduce complexity of CreateLogEventInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
snakefoot committed Dec 7, 2021
1 parent 5b14701 commit cc899b4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/NLog.Extensions.Logging/Logging/NLogLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void Log<TState>(Microsoft.Extensions.Logging.LogLevel logLevel, EventId

private LogEventInfo CreateLogEventInfo<TState>(LogLevel nLogLogLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
{
if ((_options.CaptureMessageTemplates || _options.CaptureMessageProperties) && state is IReadOnlyList<KeyValuePair<string, object>> messagePropertyList)
if (_options.CaptureMessageProperties && state is IReadOnlyList<KeyValuePair<string, object>> messagePropertyList)
{
if (_options.CaptureMessageTemplates)
{
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down

0 comments on commit cc899b4

Please sign in to comment.