Skip to content

Commit bcc5021

Browse files
committed
Ordinal string comparisons
1 parent 03fcf95 commit bcc5021

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Serilog.Extensions.Logging/Extensions/Logging/SerilogLogger.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ LogEvent PrepareWrite<TState>(LogEventLevel level, EventId eventId, TState state
103103
{
104104
messageTemplate = value;
105105
}
106-
else if (property.Key.StartsWith("@"))
106+
else if (property.Key.StartsWith("@", StringComparison.Ordinal))
107107
{
108108
if (_logger.BindProperty(GetKeyWithoutFirstSymbol(DestructureDictionary, property.Key), property.Value, true, out var destructured))
109109
properties.Add(destructured.Name, destructured.Value);
110110
}
111-
else if (property.Key.StartsWith("$"))
111+
else if (property.Key.StartsWith("$", StringComparison.Ordinal))
112112
{
113113
if (_logger.BindProperty(GetKeyWithoutFirstSymbol(StringifyDictionary, property.Key), property.Value?.ToString(), true, out var stringified))
114114
properties.Add(stringified.Name, stringified.Value);

src/Serilog.Extensions.Logging/Extensions/Logging/SerilogLoggerScope.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ static void AddProperty(LogEvent logEvent, ILogEventPropertyFactory propertyFact
9595
{
9696
var destructureObject = false;
9797

98-
if (key.StartsWith("@"))
98+
if (key.StartsWith("@", StringComparison.Ordinal))
9999
{
100100
key = SerilogLogger.GetKeyWithoutFirstSymbol(SerilogLogger.DestructureDictionary, key);
101101
destructureObject = true;
102102
}
103-
else if (key.StartsWith("$"))
103+
else if (key.StartsWith("$", StringComparison.Ordinal))
104104
{
105105
key = SerilogLogger.GetKeyWithoutFirstSymbol(SerilogLogger.StringifyDictionary, key);
106106
value = value?.ToString();

0 commit comments

Comments
 (0)