Skip to content

Commit

Permalink
feat: updated nuget-dependencies and introduced IncludeEventProperties (
Browse files Browse the repository at this point in the history
  • Loading branch information
snakefoot authored Nov 30, 2023
1 parent eb57894 commit d9a9218
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

<ItemGroup>
<ProjectReference Include="..\NLog.Targets.ElasticSearch\NLog.Targets.ElasticSearch.csproj" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
13 changes: 10 additions & 3 deletions src/NLog.Targets.ElasticSearch/ElasticSearchTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,19 @@ public string CloudId
public Layout Index { get; set; } = "logstash-${date:format=yyyy.MM.dd}";

/// <summary>
/// Obsolete and replaced by <see cref="IncludeEventProperties"/> to match NLog naming convention.
/// Gets or sets whether to include all properties of the log event in the document
/// </summary>
public bool IncludeAllProperties { get; set; }
[Obsolete("Replaced by IncludeEventProperties")]
public bool IncludeAllProperties { get => IncludeEventProperties; set => IncludeEventProperties = value; }

/// <summary>
/// Gets or sets a comma separated list of excluded properties when setting <see cref="IElasticSearchTarget.IncludeAllProperties"/>
/// Gets or sets whether to include LogEvent Properties in the document
/// </summary>
public bool IncludeEventProperties { get; set; }

/// <summary>
/// Gets or sets a comma separated list of excluded properties when setting <see cref="IElasticSearchTarget.IncludeEventProperties"/>
/// </summary>
public string ExcludedProperties { get; set; }

Expand Down Expand Up @@ -506,7 +513,7 @@ private Dictionary<string, object> GenerateDocumentProperties(LogEventInfo logEv
}
}

if (IncludeAllProperties && logEvent.HasProperties)
if (IncludeEventProperties && logEvent.HasProperties)
{
foreach (var p in logEvent.Properties)
{
Expand Down
9 changes: 8 additions & 1 deletion src/NLog.Targets.ElasticSearch/IElasticSearchTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,19 @@ public interface IElasticSearchTarget
Layout Index { get; set; }

/// <summary>
/// Obsolete and replaced by <see cref="IncludeEventProperties"/> to match NLog naming convention.
/// Gets or sets whether to include all properties of the log event in the document
/// </summary>
[Obsolete("Replaced by IncludeEventProperties")]
bool IncludeAllProperties { get; set; }

/// <summary>
/// Gets or sets a comma separated list of excluded properties when setting <see cref="IncludeAllProperties"/>
/// Gets or sets whether to include LogEvent Properties in the document
/// </summary>
bool IncludeEventProperties { get; set; }

/// <summary>
/// Gets or sets a comma separated list of excluded properties when setting <see cref="IncludeEventProperties"/>
/// </summary>
string ExcludedProperties { get; set; }

Expand Down
10 changes: 5 additions & 5 deletions src/NLog.Targets.ElasticSearch/NLog.Targets.ElasticSearch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Elasticsearch.Net" Version="7.13.2" />
<PackageReference Include="NEST" Version="7.13.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NLog" Version="4.6.8" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Elasticsearch.Net" Version="7.17.5" />
<PackageReference Include="NEST" Version="7.17.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NLog" Version="4.7.15" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
</Project>

0 comments on commit d9a9218

Please sign in to comment.