From 0f5a2b4ff11a950554352c04ad0d30a0d1020f82 Mon Sep 17 00:00:00 2001 From: Martin Rapavy Date: Fri, 20 Oct 2023 17:44:31 -0500 Subject: [PATCH] EcsEvent: Tags - changed from array to IList --- src/SerilogEcsLogging/Logging/EcsEvent.cs | 4 ++-- src/SerilogEcsLogging/Logging/IEcsEvent.cs | 2 +- src/SerilogEcsLogging/Logging/LoggerExtensions.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SerilogEcsLogging/Logging/EcsEvent.cs b/src/SerilogEcsLogging/Logging/EcsEvent.cs index 620fde9..569a5cf 100644 --- a/src/SerilogEcsLogging/Logging/EcsEvent.cs +++ b/src/SerilogEcsLogging/Logging/EcsEvent.cs @@ -6,7 +6,7 @@ public class EcsEvent : IEcsEvent public string EventKind { get; } - public string[]? Tags { get; } + public IList? Tags { get; } public bool? EventOutcome { get; set; } @@ -20,7 +20,7 @@ public class EcsEvent : IEcsEvent public string? TraceId { get; set; } - public EcsEvent(string eventAction, string eventKind = Elastic.CommonSchema.EventKind.Event, string[]? tags = null, bool? eventOutcome = null, TimeSpan? eventDuration = null, string? message = null, object? eventData = null, string? transactionId = null, string? traceId = null) + public EcsEvent(string eventAction, string eventKind = Elastic.CommonSchema.EventKind.Event, IList? tags = null, bool? eventOutcome = null, TimeSpan? eventDuration = null, string? message = null, object? eventData = null, string? transactionId = null, string? traceId = null) { EventAction = eventAction; EventKind = eventKind; diff --git a/src/SerilogEcsLogging/Logging/IEcsEvent.cs b/src/SerilogEcsLogging/Logging/IEcsEvent.cs index 2e14115..f063071 100644 --- a/src/SerilogEcsLogging/Logging/IEcsEvent.cs +++ b/src/SerilogEcsLogging/Logging/IEcsEvent.cs @@ -6,7 +6,7 @@ public interface IEcsEvent string EventKind { get; } - string[]? Tags { get; } + IList? Tags { get; } bool? EventOutcome { get; set; } diff --git a/src/SerilogEcsLogging/Logging/LoggerExtensions.cs b/src/SerilogEcsLogging/Logging/LoggerExtensions.cs index 261e7a7..e3a8b6b 100644 --- a/src/SerilogEcsLogging/Logging/LoggerExtensions.cs +++ b/src/SerilogEcsLogging/Logging/LoggerExtensions.cs @@ -40,7 +40,7 @@ public static void LogEvent(this ILogger logger, LogLevel logLevel, Exception? e outcome = Elastic.CommonSchema.EventOutcome.Failure; } - using (logger.BeginScope($"{{{LogFilename}}} {{{LogLineNumber}}} {{{LogMethodName}}} {{{EventActionSeverity}}} {{{EventActionName}}} {{{EventActionKind}}} {{{EventDuration}}} {{{EventOutcome}}} {{{EventStart}}} {{@{EventData}}} {{@{Tags}}}", sourceFilePath, sourceLineNumber, memberName, LogLevel.None - logLevel, ecsEvent.EventAction, ecsEvent.EventKind, ecsEvent.EventDuration, outcome, eventStart, ecsEvent.EventData, ecsEvent.Tags?.ToList())) + using (logger.BeginScope($"{{{LogFilename}}} {{{LogLineNumber}}} {{{LogMethodName}}} {{{EventActionSeverity}}} {{{EventActionName}}} {{{EventActionKind}}} {{{EventDuration}}} {{{EventOutcome}}} {{{EventStart}}} {{@{EventData}}} {{@{Tags}}}", sourceFilePath, sourceLineNumber, memberName, LogLevel.None - logLevel, ecsEvent.EventAction, ecsEvent.EventKind, ecsEvent.EventDuration, outcome, eventStart, ecsEvent.EventData, ecsEvent.Tags)) { logger.Log(logLevel, exception, ecsEvent.EventMessage); }