Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: updated nuget-dependencies and introduced IncludeEventProperties #180

Merged
merged 1 commit into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>