Skip to content

Commit c6de2ef

Browse files
authored
Merge pull request #203 from datalust/dev
6.0.0 Release
2 parents fb033d7 + dcc4cc2 commit c6de2ef

33 files changed

Lines changed: 1515 additions & 1626 deletions

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ artifacts:
1717
deploy:
1818
- provider: NuGet
1919
api_key:
20-
secure: TvgNpWJrz95fIzB0+OHqDpzjVgN1BYY9ogCPmYdpmXs3Q7yuya3sz0TQc9UlvJrk
20+
secure: 50FmAHNDUONde6WmXHMoPBZ3uW82emXRQsr9zYNotYctEMFN+k15Y830yj/cgggk
2121
skip_symbols: true
2222
on:
2323
branch: /^(main|dev)$/

sample/BlazorWasm/BlazorWasm.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0" />
11-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0" PrivateAssets="all" />
12-
<PackageReference Include="serilog.extensions.logging" Version="3.1.0" />
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.11" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.11" PrivateAssets="all" />
12+
<PackageReference Include="serilog.extensions.logging" Version="7.0.0" />
1313
<PackageReference Include="serilog.sinks.browserconsole" Version="1.0.0" />
1414
</ItemGroup>
1515

src/Serilog.Sinks.Seq/SeqLoggerConfigurationExtensions.cs

Lines changed: 130 additions & 127 deletions
Large diffs are not rendered by default.
Lines changed: 14 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<Description>Serilog sink that writes to the Seq log server over HTTP/HTTPS.</Description>
5-
<VersionPrefix>5.2.3</VersionPrefix>
6-
<Authors>Serilog Contributors</Authors>
7-
<Copyright>Copyright © Serilog Contributors</Copyright>
8-
<TargetFrameworks>net5.0;netstandard1.1;netstandard1.3;netstandard2.0;net4.5;netcoreapp3.1</TargetFrameworks>
4+
<Description>A Serilog sink that writes events to Seq using newline-delimited JSON and HTTP/HTTPS.</Description>
5+
<VersionPrefix>6.0.0</VersionPrefix>
6+
<Authors>Serilog Contributors;Serilog.Sinks.Seq Contributors;Datalust Pty Ltd</Authors>
7+
<Copyright>Copyright © Serilog Contributors, Serilog.Sinks.Seq Contributors, Datalust Pty Ltd.</Copyright>
8+
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
99
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1111
<RootNamespace>Serilog</RootNamespace>
@@ -16,59 +16,29 @@
1616
<PackageIcon>icon.png</PackageIcon>
1717
<PackageProjectUrl>https://github.com/serilog/serilog-sinks-seq</PackageProjectUrl>
1818
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
19-
<RepositoryUrl>https://github.com/serilog/serilog-sinks-seq</RepositoryUrl>
19+
<RepositoryUrl>https://github.com/datalust/serilog-sinks-seq</RepositoryUrl>
2020
<RepositoryType>git</RepositoryType>
2121
<GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
22-
<LangVersion>9</LangVersion>
22+
<LangVersion>10</LangVersion>
2323
<Nullable>enable</Nullable>
24-
<CheckEolTargetFramework>false</CheckEolTargetFramework>
24+
<PackageReadmeFile>README.md</PackageReadmeFile>
2525
</PropertyGroup>
2626

27-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
28-
<DefineConstants>$(DefineConstants);DURABLE;THREADING_TIMER</DefineConstants>
27+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
28+
<DefineConstants>$(DefineConstants);WRITE_ALL_BYTES_ASYNC;ASYNC_DISPOSE;SOCKETS_HTTP_HANDLER_ALWAYS_DEFAULT;ARCHITECTURE_WASM</DefineConstants>
2929
</PropertyGroup>
30-
31-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
32-
<DefineConstants>$(DefineConstants);DURABLE;THREADING_TIMER</DefineConstants>
33-
</PropertyGroup>
34-
35-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
36-
<DefineConstants>$(DefineConstants);DURABLE;THREADING_TIMER;WRITE_ALL_BYTES_ASYNC;ASYNC_DISPOSE</DefineConstants>
37-
</PropertyGroup>
38-
39-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
40-
<DefineConstants>$(DefineConstants);DURABLE;THREADING_TIMER;WRITE_ALL_BYTES_ASYNC;ASYNC_DISPOSE;SOCKETS_HTTP_HANDLER_ALWAYS_DEFAULT;ARCHITECTURE_WASM</DefineConstants>
41-
</PropertyGroup>
42-
43-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net4.5' ">
44-
<DefineConstants>$(DefineConstants);DURABLE;THREADING_TIMER;HRESULTS</DefineConstants>
45-
</PropertyGroup>
46-
47-
<ItemGroup Condition=" '$(TargetFramework)' == 'net4.5' ">
48-
<Reference Include="System.Net.Http" />
49-
</ItemGroup>
5030

5131
<ItemGroup>
52-
<PackageReference Include="Serilog" Version="2.12.0" />
32+
<PackageReference Include="Serilog" Version="3.1.1" />
5333
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="3.1.0" />
54-
<PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
34+
<PackageReference Include="Serilog.Formatting.Compact" Version="2.0.0" />
5535
<PackageReference Include="Nullable" Version="1.3.1" PrivateAssets="All" />
56-
</ItemGroup>
57-
58-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.1' ">
59-
<PackageReference Include="System.Net.Http" Version="4.3.4" />
60-
</ItemGroup>
61-
62-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
63-
<PackageReference Include="System.Net.Http" Version="4.3.4" />
64-
</ItemGroup>
65-
66-
<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard1.1' ">
6736
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
6837
</ItemGroup>
69-
38+
7039
<ItemGroup>
7140
<None Include="..\..\assets\icon.png" Pack="true" Visible="false" PackagePath="" />
41+
<None Include="..\..\README.md" Pack="true" Visible="false" PackagePath="" />
7242
</ItemGroup>
7343

7444
</Project>

src/Serilog.Sinks.Seq/Sinks/Seq/Audit/SeqAuditSink.cs

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,42 @@
1717
using System.Threading.Tasks;
1818
using Serilog.Core;
1919
using Serilog.Events;
20-
using Serilog.Formatting.Compact;
21-
using Serilog.Formatting.Json;
20+
using Serilog.Formatting;
2221
using Serilog.Sinks.Seq.Http;
2322

24-
namespace Serilog.Sinks.Seq.Audit
25-
{
26-
/// <summary>
27-
/// An <see cref="ILogEventSink"/> that synchronously propagates all <see cref="Emit"/> failures as exceptions.
28-
/// </summary>
29-
sealed class SeqAuditSink : ILogEventSink, IDisposable
30-
{
31-
readonly SeqIngestionApi _ingestionApi;
23+
namespace Serilog.Sinks.Seq.Audit;
3224

33-
static readonly JsonValueFormatter JsonValueFormatter = new("$type");
25+
/// <summary>
26+
/// An <see cref="ILogEventSink"/> that synchronously propagates all <see cref="Emit"/> failures as exceptions.
27+
/// </summary>
28+
sealed class SeqAuditSink : ILogEventSink, IDisposable
29+
{
30+
readonly SeqIngestionApi _ingestionApi;
31+
readonly ITextFormatter _payloadFormatter;
3432

35-
public SeqAuditSink(SeqIngestionApi ingestionApi)
36-
{
37-
_ingestionApi = ingestionApi ?? throw new ArgumentNullException(nameof(ingestionApi));
38-
}
33+
public SeqAuditSink(SeqIngestionApi ingestionApi, ITextFormatter payloadFormatter)
34+
{
35+
_ingestionApi = ingestionApi ?? throw new ArgumentNullException(nameof(ingestionApi));
36+
_payloadFormatter = payloadFormatter ?? throw new ArgumentNullException(nameof(payloadFormatter));
37+
}
3938

40-
public void Dispose()
41-
{
42-
_ingestionApi.Dispose();
43-
}
39+
public void Dispose()
40+
{
41+
_ingestionApi.Dispose();
42+
}
4443

45-
public void Emit(LogEvent logEvent)
46-
{
47-
EmitAsync(logEvent).Wait();
48-
}
44+
public void Emit(LogEvent logEvent)
45+
{
46+
EmitAsync(logEvent).Wait();
47+
}
4948

50-
async Task EmitAsync(LogEvent logEvent)
51-
{
52-
if (logEvent == null) throw new ArgumentNullException(nameof(logEvent));
49+
async Task EmitAsync(LogEvent logEvent)
50+
{
51+
if (logEvent == null) throw new ArgumentNullException(nameof(logEvent));
5352

54-
var payload = new StringWriter();
55-
CompactJsonFormatter.FormatEvent(logEvent, payload, JsonValueFormatter);
53+
var payload = new StringWriter();
54+
_payloadFormatter.Format(logEvent, payload);
5655

57-
await _ingestionApi.IngestAsync(payload.ToString()).ConfigureAwait(false);
58-
}
56+
await _ingestionApi.IngestAsync(payload.ToString()).ConfigureAwait(false);
5957
}
6058
}

src/Serilog.Sinks.Seq/Sinks/Seq/Batched/BatchedSeqSink.cs

Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -18,65 +18,66 @@
1818
using System.Linq;
1919
using System.Threading.Tasks;
2020
using Serilog.Events;
21+
using Serilog.Formatting;
2122
using Serilog.Sinks.PeriodicBatching;
2223
using Serilog.Sinks.Seq.Http;
2324

24-
namespace Serilog.Sinks.Seq.Batched
25+
namespace Serilog.Sinks.Seq.Batched;
26+
27+
/// <summary>
28+
/// The default Seq sink, for use in combination with <see cref="PeriodicBatchingSink"/>.
29+
/// </summary>
30+
sealed class BatchedSeqSink : IBatchedLogEventSink, IDisposable
2531
{
26-
/// <summary>
27-
/// The default Seq sink, for use in combination with <see cref="PeriodicBatchingSink"/>.
28-
/// </summary>
29-
sealed class BatchedSeqSink : IBatchedLogEventSink, IDisposable
30-
{
31-
static readonly TimeSpan RequiredLevelCheckInterval = TimeSpan.FromMinutes(2);
32+
static readonly TimeSpan RequiredLevelCheckInterval = TimeSpan.FromMinutes(2);
3233

33-
readonly ConstrainedBufferedFormatter _formatter;
34-
readonly SeqIngestionApi _ingestionApi;
34+
readonly ConstrainedBufferedFormatter _payloadFormatter;
35+
readonly SeqIngestionApi _ingestionApi;
3536

36-
DateTime _nextRequiredLevelCheckUtc = DateTime.UtcNow.Add(RequiredLevelCheckInterval);
37-
readonly ControlledLevelSwitch _controlledSwitch;
37+
DateTime _nextRequiredLevelCheckUtc = DateTime.UtcNow.Add(RequiredLevelCheckInterval);
38+
readonly ControlledLevelSwitch _controlledSwitch;
3839

39-
public BatchedSeqSink(
40-
SeqIngestionApi ingestionApi,
41-
long? eventBodyLimitBytes,
42-
ControlledLevelSwitch controlledSwitch)
43-
{
44-
_controlledSwitch = controlledSwitch ?? throw new ArgumentNullException(nameof(controlledSwitch));
45-
_formatter = new ConstrainedBufferedFormatter(eventBodyLimitBytes);
46-
_ingestionApi = ingestionApi ?? throw new ArgumentNullException(nameof(ingestionApi));
47-
}
40+
public BatchedSeqSink(
41+
SeqIngestionApi ingestionApi,
42+
ITextFormatter payloadFormatter,
43+
long? eventBodyLimitBytes,
44+
ControlledLevelSwitch controlledSwitch)
45+
{
46+
_controlledSwitch = controlledSwitch ?? throw new ArgumentNullException(nameof(controlledSwitch));
47+
_payloadFormatter = new ConstrainedBufferedFormatter(eventBodyLimitBytes, payloadFormatter);
48+
_ingestionApi = ingestionApi ?? throw new ArgumentNullException(nameof(ingestionApi));
49+
}
4850

49-
public void Dispose()
50-
{
51-
_ingestionApi.Dispose();
52-
}
51+
public void Dispose()
52+
{
53+
_ingestionApi.Dispose();
54+
}
5355

54-
// The sink must emit at least one event on startup, and the server be
55-
// configured to set a specific level, before background level checks will be performed.
56-
public async Task OnEmptyBatchAsync()
56+
// The sink must emit at least one event on startup, and the server be
57+
// configured to set a specific level, before background level checks will be performed.
58+
public async Task OnEmptyBatchAsync()
59+
{
60+
if (_controlledSwitch.IsActive &&
61+
_nextRequiredLevelCheckUtc < DateTime.UtcNow)
5762
{
58-
if (_controlledSwitch.IsActive &&
59-
_nextRequiredLevelCheckUtc < DateTime.UtcNow)
60-
{
61-
await EmitBatchAsync(Enumerable.Empty<LogEvent>());
62-
}
63+
await EmitBatchAsync(Enumerable.Empty<LogEvent>());
6364
}
65+
}
6466

65-
public async Task EmitBatchAsync(IEnumerable<LogEvent> events)
66-
{
67-
_nextRequiredLevelCheckUtc = DateTime.UtcNow.Add(RequiredLevelCheckInterval);
67+
public async Task EmitBatchAsync(IEnumerable<LogEvent> events)
68+
{
69+
_nextRequiredLevelCheckUtc = DateTime.UtcNow.Add(RequiredLevelCheckInterval);
6870

69-
var payload = new StringWriter();
70-
foreach (var evt in events)
71-
{
72-
_formatter.Format(evt, payload);
73-
}
71+
var payload = new StringWriter();
72+
foreach (var evt in events)
73+
{
74+
_payloadFormatter.Format(evt, payload);
75+
}
7476

75-
var clefPayload = payload.ToString();
77+
var clefPayload = payload.ToString();
7678

77-
var minimumAcceptedLevel = await _ingestionApi.IngestAsync(clefPayload);
79+
var minimumAcceptedLevel = await _ingestionApi.IngestAsync(clefPayload);
7880

79-
_controlledSwitch.Update(minimumAcceptedLevel);
80-
}
81+
_controlledSwitch.Update(minimumAcceptedLevel);
8182
}
82-
}
83+
}

0 commit comments

Comments
 (0)