Skip to content

Commit 4201324

Browse files
authored
Fix serialization of Serilog.Sinks not including log.level (#512)
(cherry picked from commit ade536c)
1 parent 6714bfe commit 4201324

File tree

25 files changed

+55
-23
lines changed

25 files changed

+55
-23
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ resharper_csharp_accessor_owner_body=expression_body
207207

208208
resharper_redundant_case_label_highlighting=do_not_show
209209
resharper_redundant_argument_default_value_highlighting=do_not_show
210+
dotnet_diagnostic.xUnit1041.severity = none
210211

211212
[*.{sh,bat,ps1}]
212213
trim_trailing_whitespace=true

examples/Elastic.Extensions.Logging.Example/Elastic.Extensions.Logging.Example.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
12-
<PackageReference Include="Elastic.Elasticsearch.Ephemeral" Version="0.4.3" />
12+
<PackageReference Include="Elastic.Elasticsearch.Ephemeral" Version="0.6.0" />
1313
<PackageReference Include="NEST" Version="7.8.1" />
1414
</ItemGroup>
1515

examples/Elastic.Serilog.Sinks.Example/Elastic.Serilog.Sinks.Example.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<PackageReference Include="Elastic.Apm" Version="1.22.0" />
1212
<PackageReference Include="Serilog" Version="4.1.0" />
1313
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
14-
<PackageReference Include="Elastic.Elasticsearch.Ephemeral" Version="0.4.3" />
1514
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.16.2" />
15+
<PackageReference Include="Elastic.Elasticsearch.Ephemeral" Version="0.6.0" />
1616
<PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" />
1717
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
1818
</ItemGroup>

examples/aspnetcore-with-extensions-logging/aspnetcore-with-extensions-logging.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Elastic.Elasticsearch.Ephemeral" Version="0.4.3" />
11+
<PackageReference Include="Elastic.Elasticsearch.Ephemeral" Version="0.6.0" />
1212
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.16.2" />
1313
</ItemGroup>
1414

examples/playground/playground.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="Elastic.Elasticsearch.Ephemeral" Version="0.5.0" />
15+
<PackageReference Include="Elastic.Elasticsearch.Ephemeral" Version="0.6.0" />
1616
</ItemGroup>
1717

1818
</Project>

src/Elastic.CommonSchema.Serilog/LogEventConverter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
using System.Diagnostics.CodeAnalysis;
88
using System.Linq;
99
using System.Text.Json.Serialization;
10+
using Elastic.CommonSchema.Serialization;
1011
using Serilog.Events;
1112
using static Elastic.CommonSchema.Serilog.SpecialProperties;
1213

1314
namespace Elastic.CommonSchema.Serilog
1415
{
1516
/// A specialized instance of <see cref="EcsDocument"/> that holds on to the original <see cref="LogEvent"/>
1617
/// <para> This property won't be emitted to JSON but is used to report back to serilog failure pipelines</para>
18+
[JsonConverter(typeof(EcsDocumentJsonConverterFactory))]
1719
public class LogEventEcsDocument : EcsDocument
1820
{
1921
/// The original <see cref="LogEvent"/> for bookkeeping, not send over to Elasticsearch

src/Elastic.CommonSchema/Serialization/EcsDocumentJsonConverter.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,5 @@ private static void WriteTimestamp(Utf8JsonWriter writer, BaseFieldSet value, Js
102102
/// <summary> A JsonConverter for <see cref="EcsDocument"/> that supports the
103103
/// https://github.com/elastic/ecs-logging specification
104104
/// </summary>
105-
public class EcsDocumentJsonConverter : EcsDocumentJsonConverter<EcsDocument>
106-
{
107-
}
105+
public class EcsDocumentJsonConverter : EcsDocumentJsonConverter<EcsDocument>;
108106
}

tests-integration/Directory.Build.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
<SignAssembly>true</SignAssembly>
1010
<AssemblyOriginatorKeyFile>..\..\build\keys\keypair.snk</AssemblyOriginatorKeyFile>
11-
</PropertyGroup>
11+
<NoWarn>xUnit1041</NoWarn>
12+
</PropertyGroup>
1213
<ItemGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(ProjectName), '^(.*)Tests$'))">
1314

1415
<PackageReference Include="JunitXml.TestLogger" Version="3.0.114" PrivateAssets="All" />

tests-integration/Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests/Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<ItemGroup>
1313
<PackageReference Include="BenchmarkDotNet" Version="0.13.1"/>
1414
<PackageReference Include="BenchmarkDotNet.Annotations" Version="0.13.1"/>
15+
<PackageReference Update="xunit" Version="2.9.3" />
1516
</ItemGroup>
1617

1718
<ItemGroup>

tests-integration/Elastic.Extensions.Logging.IntegrationTests/Elastic.Extensions.Logging.IntegrationTests.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@
1010
<ProjectReference Include="..\Elasticsearch.IntegrationDefaults\Elasticsearch.IntegrationDefaults.csproj" />
1111
</ItemGroup>
1212

13+
<ItemGroup>
14+
<PackageReference Update="xunit" Version="2.9.3" />
15+
</ItemGroup>
16+
1317
</Project>

0 commit comments

Comments
 (0)