From d9a9218a56e59778df525c5c281ad719ba5a79ec Mon Sep 17 00:00:00 2001 From: Rolf Kristensen Date: Thu, 30 Nov 2023 18:30:53 +0100 Subject: [PATCH] feat: updated nuget-dependencies and introduced IncludeEventProperties (#180) --- .../NLog.Targets.ElasticSearch.Tests.csproj | 7 +++++-- .../ElasticSearchTarget.cs | 13 ++++++++++--- .../IElasticSearchTarget.cs | 9 ++++++++- .../NLog.Targets.ElasticSearch.csproj | 10 +++++----- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/NLog.Targets.ElasticSearch.Tests/NLog.Targets.ElasticSearch.Tests.csproj b/src/NLog.Targets.ElasticSearch.Tests/NLog.Targets.ElasticSearch.Tests.csproj index d54632f..867ab24 100644 --- a/src/NLog.Targets.ElasticSearch.Tests/NLog.Targets.ElasticSearch.Tests.csproj +++ b/src/NLog.Targets.ElasticSearch.Tests/NLog.Targets.ElasticSearch.Tests.csproj @@ -6,8 +6,11 @@ - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/NLog.Targets.ElasticSearch/ElasticSearchTarget.cs b/src/NLog.Targets.ElasticSearch/ElasticSearchTarget.cs index 0d66eba..4fa64d2 100644 --- a/src/NLog.Targets.ElasticSearch/ElasticSearchTarget.cs +++ b/src/NLog.Targets.ElasticSearch/ElasticSearchTarget.cs @@ -145,12 +145,19 @@ public string CloudId public Layout Index { get; set; } = "logstash-${date:format=yyyy.MM.dd}"; /// + /// Obsolete and replaced by to match NLog naming convention. /// Gets or sets whether to include all properties of the log event in the document /// - public bool IncludeAllProperties { get; set; } + [Obsolete("Replaced by IncludeEventProperties")] + public bool IncludeAllProperties { get => IncludeEventProperties; set => IncludeEventProperties = value; } /// - /// Gets or sets a comma separated list of excluded properties when setting + /// Gets or sets whether to include LogEvent Properties in the document + /// + public bool IncludeEventProperties { get; set; } + + /// + /// Gets or sets a comma separated list of excluded properties when setting /// public string ExcludedProperties { get; set; } @@ -506,7 +513,7 @@ private Dictionary GenerateDocumentProperties(LogEventInfo logEv } } - if (IncludeAllProperties && logEvent.HasProperties) + if (IncludeEventProperties && logEvent.HasProperties) { foreach (var p in logEvent.Properties) { diff --git a/src/NLog.Targets.ElasticSearch/IElasticSearchTarget.cs b/src/NLog.Targets.ElasticSearch/IElasticSearchTarget.cs index 08cfc6e..c27e3a2 100644 --- a/src/NLog.Targets.ElasticSearch/IElasticSearchTarget.cs +++ b/src/NLog.Targets.ElasticSearch/IElasticSearchTarget.cs @@ -92,12 +92,19 @@ public interface IElasticSearchTarget Layout Index { get; set; } /// + /// Obsolete and replaced by to match NLog naming convention. /// Gets or sets whether to include all properties of the log event in the document /// + [Obsolete("Replaced by IncludeEventProperties")] bool IncludeAllProperties { get; set; } /// - /// Gets or sets a comma separated list of excluded properties when setting + /// Gets or sets whether to include LogEvent Properties in the document + /// + bool IncludeEventProperties { get; set; } + + /// + /// Gets or sets a comma separated list of excluded properties when setting /// string ExcludedProperties { get; set; } diff --git a/src/NLog.Targets.ElasticSearch/NLog.Targets.ElasticSearch.csproj b/src/NLog.Targets.ElasticSearch/NLog.Targets.ElasticSearch.csproj index e2167f4..4767639 100644 --- a/src/NLog.Targets.ElasticSearch/NLog.Targets.ElasticSearch.csproj +++ b/src/NLog.Targets.ElasticSearch/NLog.Targets.ElasticSearch.csproj @@ -14,10 +14,10 @@ true - - - - - + + + + + \ No newline at end of file