Skip to content

Commit 2df5d15

Browse files
bsnsaxoMpdreamz
andauthored
Extended LogEventConverter.ConvertToEcs<>() (#460)
Extended LogEventConverter.ConvertToEcs<>() with an optional EcsDocumentCreationCache input parameter that gets passed into EcsDocument.CreateNewWithDefaults<>() This is to support overwrites of static data such as those in EcsDocument.Service Co-authored-by: Martijn Laarman <[email protected]>
1 parent 7eee1b3 commit 2df5d15

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Elastic.CommonSchema.Serilog/LogEventConverter.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ public static class LogEventConverter
2121
/// <summary>
2222
/// Converts a <see cref="LogEvent"/> to an <typeparamref name="TEcsDocument"/>
2323
/// </summary>
24-
public static TEcsDocument ConvertToEcs<TEcsDocument>(LogEvent logEvent, IEcsTextFormatterConfiguration<TEcsDocument> configuration)
24+
public static TEcsDocument ConvertToEcs<TEcsDocument>(LogEvent logEvent, IEcsTextFormatterConfiguration<TEcsDocument> configuration, EcsDocumentCreationCache? initialCache = null)
2525
where TEcsDocument : EcsDocument, new()
2626
{
27-
var ecsEvent = EcsDocument.CreateNewWithDefaults<TEcsDocument>(logEvent.Timestamp, logEvent.Exception, configuration);
27+
var ecsEvent = EcsDocument.CreateNewWithDefaults<TEcsDocument>(logEvent.Timestamp, logEvent.Exception, configuration, initialCache);
2828

2929
if (logEvent.TryGetScalarString(SpecialKeys.MachineName, out var machineName))
3030
{

0 commit comments

Comments
 (0)