Skip to content

Commit f5aa6e6

Browse files
committed
Add support for ICustomFormatter
1 parent cf59d53 commit f5aa6e6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Serilog.Sinks.OpenTelemetry/Sinks/OpenTelemetry/Formatting/CleanMessageTemplateFormatter.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ static void RenderPropertyValueUnaligned(LogEventPropertyValue propertyValue, Te
9595

9696
var value = scalar.Value;
9797

98+
if (formatProvider?.GetFormat(typeof(ICustomFormatter)) is ICustomFormatter customFormatter)
99+
{
100+
output.Write(customFormatter.Format(format, value, formatProvider));
101+
return;
102+
}
103+
98104
if (value == null)
99105
{
100106
output.Write("null");

0 commit comments

Comments
 (0)