-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from datalust/dev
5.1.0 Release
- Loading branch information
Showing
40 changed files
with
895 additions
and
531 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"sdk": { | ||
"version": "5.0.202", | ||
"rollForward": "latestPatch" | ||
"version": "5.0.401", | ||
"rollForward": "latestFeature" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Description>Sample Console Application</Description> | ||
<Authors>nblumhardt</Authors> | ||
<TargetFrameworks>netcoreapp3.1;net47</TargetFrameworks> | ||
<AssemblyName>Sample</AssemblyName> | ||
<TargetFrameworks>net4.8;net5.0</TargetFrameworks> | ||
<OutputType>Exe</OutputType> | ||
<PackageId>Sample</PackageId> | ||
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute> | ||
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute> | ||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> | ||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> | ||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> | ||
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute> | ||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
<LangVersion>latest</LangVersion> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition=" '$(TargetFramework)' == 'net47' "> | ||
<ItemGroup Condition=" '$(TargetFramework)' == 'net4.8' "> | ||
<Reference Include="System.Net.Http" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Serilog.Sinks.Seq\Serilog.Sinks.Seq.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="logs\" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright © Serilog Contributors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Serilog.Events; | ||
using Serilog.Sinks.PeriodicBatching; | ||
using Serilog.Sinks.Seq.Http; | ||
|
||
namespace Serilog.Sinks.Seq.Batched | ||
{ | ||
/// <summary> | ||
/// The default Seq sink, for use in combination with <see cref="PeriodicBatchingSink"/>. | ||
/// </summary> | ||
sealed class BatchedSeqSink : IBatchedLogEventSink, IDisposable | ||
{ | ||
static readonly TimeSpan RequiredLevelCheckInterval = TimeSpan.FromMinutes(2); | ||
|
||
readonly ConstrainedBufferedFormatter _formatter; | ||
readonly SeqIngestionApi _ingestionApi; | ||
|
||
DateTime _nextRequiredLevelCheckUtc = DateTime.UtcNow.Add(RequiredLevelCheckInterval); | ||
readonly ControlledLevelSwitch _controlledSwitch; | ||
|
||
public BatchedSeqSink( | ||
SeqIngestionApi ingestionApi, | ||
long? eventBodyLimitBytes, | ||
ControlledLevelSwitch controlledSwitch) | ||
{ | ||
_controlledSwitch = controlledSwitch ?? throw new ArgumentNullException(nameof(controlledSwitch)); | ||
_formatter = new ConstrainedBufferedFormatter(eventBodyLimitBytes); | ||
_ingestionApi = ingestionApi ?? throw new ArgumentNullException(nameof(ingestionApi)); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_ingestionApi.Dispose(); | ||
} | ||
|
||
// The sink must emit at least one event on startup, and the server be | ||
// configured to set a specific level, before background level checks will be performed. | ||
public async Task OnEmptyBatchAsync() | ||
{ | ||
if (_controlledSwitch.IsActive && | ||
_nextRequiredLevelCheckUtc < DateTime.UtcNow) | ||
{ | ||
await EmitBatchAsync(Enumerable.Empty<LogEvent>()); | ||
} | ||
} | ||
|
||
public async Task EmitBatchAsync(IEnumerable<LogEvent> events) | ||
{ | ||
_nextRequiredLevelCheckUtc = DateTime.UtcNow.Add(RequiredLevelCheckInterval); | ||
|
||
var payload = new StringWriter(); | ||
foreach (var evt in events) | ||
{ | ||
_formatter.Format(evt, payload); | ||
} | ||
|
||
var clefPayload = payload.ToString(); | ||
|
||
var minimumAcceptedLevel = await _ingestionApi.IngestAsync(clefPayload); | ||
|
||
_controlledSwitch.Update(minimumAcceptedLevel); | ||
} | ||
} | ||
} |
Oops, something went wrong.