Skip to content

Commit 3a3510b

Browse files
committed
PR feedback part 1
1 parent 064c964 commit 3a3510b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/MicrosoftExtensionsLogging/MicrosoftLoggingWrapper.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ public class MicrosoftLoggingWrapper : IWrapper
2626

2727
private const string WrapperName = "MicrosoftLogging";
2828

29+
// This is defined here: https://github.com/dotnet/runtime/blob/54e4456b01060f54e5bb7d715e77e5f41bac558f/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/LogValuesFormatter.cs#L233
30+
private const string OriginalFormatKey = "{OriginalFormat}";
31+
2932
public CanWrapResponse CanWrap(InstrumentedMethodInfo methodInfo)
3033
{
3134
return new CanWrapResponse(WrapperName.Equals(methodInfo.RequestedWrapperName));
@@ -122,7 +125,7 @@ private static Dictionary<string, object> GetContextData(MEL.ILogger logger, IAg
122125
foreach (var kvp in stateKvps)
123126
{
124127
// Skip the "{OriginalFormat}" key — it's the message template string, not a parameter
125-
if (kvp.Key == "{OriginalFormat}")
128+
if (kvp.Key == OriginalFormatKey)
126129
continue;
127130

128131
if (kvp.Value != null)
@@ -168,4 +171,4 @@ private AfterWrappedMethodDelegate DecorateLogMessage(MEL.ILogger logger, IAgent
168171

169172
return Delegates.GetDelegateFor(onComplete: () => handle?.Dispose());
170173
}
171-
}
174+
}

0 commit comments

Comments
 (0)