Skip to content

Commit 856f8ff

Browse files
authored
Merge pull request #46 from serilog/dev
1.4.0 Release
2 parents 0322494 + 8eb1c2b commit 856f8ff

11 files changed

+62
-46
lines changed

appveyor.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
version: '{build}'
22
skip_tags: true
3-
image: Visual Studio 2017
4-
configuration: Release
3+
image: Visual Studio 2019
54
build_script:
65
- ps: ./Build.ps1
76
test: off
@@ -10,7 +9,7 @@ artifacts:
109
deploy:
1110
- provider: NuGet
1211
api_key:
13-
secure: bd9z4P73oltOXudAjPehwp9iDKsPtC+HbgshOrSgoyQKr5xVK+bxJQngrDJkHdY8
12+
secure: mnSqLheecloK/7XS+OjiDMlttTzhMTRyT2e9AUnS7aHR5AimjOD9vQtfodwagacH
1413
skip_symbols: true
1514
on:
1615
branch: /^(master|dev)$/

serilog-sinks-async.sln.DotSettings

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/UserDictionary/Words/=Serilog/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

src/Serilog.Sinks.Async/Serilog.Sinks.Async.csproj

+10-8
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
<PropertyGroup>
44
<Description>Asynchronous sink wrapper for Serilog.</Description>
5-
<AssemblyVersion>1.0.0</AssemblyVersion>
6-
<VersionPrefix>1.3.0</VersionPrefix>
5+
<AssemblyVersion>1.4.0.0</AssemblyVersion>
6+
<VersionPrefix>1.4.0</VersionPrefix>
77
<Authors>Jezz Santos;Serilog Contributors</Authors>
8-
<TargetFrameworks>net45;netstandard1.1</TargetFrameworks>
8+
<TargetFrameworks>net45;netstandard1.1;net461;netstandard2.0</TargetFrameworks>
99
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1111
<AssemblyName>Serilog.Sinks.Async</AssemblyName>
@@ -15,22 +15,24 @@
1515
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
1616
<PackageId>Serilog.Sinks.Async</PackageId>
1717
<PackageTags>serilog;async</PackageTags>
18-
<PackageIconUrl>http://serilog.net/images/serilog-sink-nuget.png</PackageIconUrl>
18+
<PackageIconUrl>https://serilog.net/images/serilog-sink-nuget.png</PackageIconUrl>
1919
<PackageProjectUrl>https://serilog.net</PackageProjectUrl>
20-
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
20+
<PackageLicense>Apache-2.0</PackageLicense>
21+
<RepositoryUrl>https://github.com/serilog/serilog-sinks-async</RepositoryUrl>
22+
<RepositoryType>git</RepositoryType>
2123
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
2224
</PropertyGroup>
2325

24-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
26+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' Or '$(TargetFramework)' == 'net461' ">
2527
<!-- Don't reference the full NETStandard.Library -->
2628
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
2729
</PropertyGroup>
2830

2931
<ItemGroup>
30-
<PackageReference Include="Serilog" Version="2.7.1" />
32+
<PackageReference Include="Serilog" Version="2.8.0" />
3133
</ItemGroup>
3234

33-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
35+
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' Or '$(TargetFramework)' == 'net461' ">
3436
<Reference Include="System" />
3537
<Reference Include="Microsoft.CSharp" />
3638
</ItemGroup>

src/Serilog.Sinks.Async/Sinks/Async/BackgroundWorkerSink.cs

+14-7
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ namespace Serilog.Sinks.Async
1010
{
1111
sealed class BackgroundWorkerSink : ILogEventSink, IAsyncLogEventSinkInspector, IDisposable
1212
{
13-
readonly ILogEventSink _pipeline;
13+
readonly ILogEventSink _wrappedSink;
1414
readonly bool _blockWhenFull;
1515
readonly BlockingCollection<LogEvent> _queue;
1616
readonly Task _worker;
1717
readonly IAsyncLogEventSinkMonitor _monitor;
1818

1919
long _droppedMessages;
2020

21-
public BackgroundWorkerSink(ILogEventSink pipeline, int bufferCapacity, bool blockWhenFull, IAsyncLogEventSinkMonitor monitor = null)
21+
public BackgroundWorkerSink(ILogEventSink wrappedSink, int bufferCapacity, bool blockWhenFull, IAsyncLogEventSinkMonitor monitor = null)
2222
{
2323
if (bufferCapacity <= 0) throw new ArgumentOutOfRangeException(nameof(bufferCapacity));
24-
_pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline));
24+
_wrappedSink = wrappedSink ?? throw new ArgumentNullException(nameof(wrappedSink));
2525
_blockWhenFull = blockWhenFull;
2626
_queue = new BlockingCollection<LogEvent>(bufferCapacity);
2727
_worker = Task.Factory.StartNew(Pump, CancellationToken.None, TaskCreationOptions.LongRunning | TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
@@ -64,7 +64,7 @@ public void Dispose()
6464
// Allow queued events to be flushed
6565
_worker.Wait();
6666

67-
(_pipeline as IDisposable)?.Dispose();
67+
(_wrappedSink as IDisposable)?.Dispose();
6868

6969
_monitor?.StopMonitoring(this);
7070
}
@@ -75,12 +75,19 @@ void Pump()
7575
{
7676
foreach (var next in _queue.GetConsumingEnumerable())
7777
{
78-
_pipeline.Emit(next);
78+
try
79+
{
80+
_wrappedSink.Emit(next);
81+
}
82+
catch (Exception ex)
83+
{
84+
SelfLog.WriteLine("{0} failed to emit event to wrapped sink: {1}", typeof(BackgroundWorkerSink), ex);
85+
}
7986
}
8087
}
81-
catch (Exception ex)
88+
catch (Exception fatal)
8289
{
83-
SelfLog.WriteLine("{0} fatal error in worker thread: {1}", typeof(BackgroundWorkerSink), ex);
90+
SelfLog.WriteLine("{0} fatal error in worker thread: {1}", typeof(BackgroundWorkerSink), fatal);
8491
}
8592
}
8693

test/Serilog.Sinks.Async.PerformanceTests/LatencyBenchmark.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ namespace Serilog.Sinks.Async.PerformanceTests
1111
{
1212
public class LatencyBenchmark
1313
{
14-
private readonly LogEvent _evt = new LogEvent(DateTimeOffset.Now, LogEventLevel.Information, null,
14+
readonly LogEvent _evt = new LogEvent(DateTimeOffset.Now, LogEventLevel.Information, null,
1515
new MessageTemplate(new[] {new TextToken("Hello")}), new LogEventProperty[0]);
1616

17-
private Logger _syncLogger, _asyncLogger, _fileLogger, _asyncFileLogger;
17+
Logger _syncLogger, _asyncLogger, _fileLogger, _asyncFileLogger;
1818

1919
static LatencyBenchmark()
2020
{
2121
SelfLog.Enable(new TerminatingTextWriter());
2222
}
2323

24-
[Setup]
24+
[GlobalSetup]
2525
public void Reset()
2626
{
2727
foreach (var logger in new[] { _syncLogger, _asyncLogger, _fileLogger, _asyncFileLogger})

test/Serilog.Sinks.Async.PerformanceTests/Serilog.Sinks.Async.PerformanceTests.csproj

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net46;netcoreapp1.1</TargetFrameworks>
4+
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
55
<AssemblyName>Serilog.Sinks.Async.PerformanceTests</AssemblyName>
66
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
77
<SignAssembly>true</SignAssembly>
@@ -17,10 +17,13 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
21-
<PackageReference Include="xunit" Version="2.3.1" />
22-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
23-
<PackageReference Include="BenchmarkDotNet" Version="0.10.6" />
20+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
21+
<PackageReference Include="xunit" Version="2.4.1" />
22+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
23+
<PrivateAssets>all</PrivateAssets>
24+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
25+
</PackageReference>
26+
<PackageReference Include="BenchmarkDotNet" Version="0.11.5" />
2427
<PackageReference Include="Serilog.Sinks.File" Version="3.1.0" />
2528
</ItemGroup>
2629

test/Serilog.Sinks.Async.PerformanceTests/SignallingSink.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
namespace Serilog.Sinks.Async.PerformanceTests
77
{
8-
internal class SignallingSink : ILogEventSink
8+
class SignallingSink : ILogEventSink
99
{
10-
private readonly int _expectedCount;
11-
private readonly ManualResetEvent _wh;
12-
private int _current;
10+
readonly int _expectedCount;
11+
readonly ManualResetEvent _wh;
12+
int _current;
1313

1414
public SignallingSink(int expectedCount)
1515
{

test/Serilog.Sinks.Async.PerformanceTests/ThroughputBenchmark.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ namespace Serilog.Sinks.Async.PerformanceTests
88
{
99
public class ThroughputBenchmark
1010
{
11-
private const int Count = 10000;
11+
const int Count = 10000;
1212

13-
private readonly LogEvent _evt = new LogEvent(DateTimeOffset.Now, LogEventLevel.Information, null,
13+
readonly LogEvent _evt = new LogEvent(DateTimeOffset.Now, LogEventLevel.Information, null,
1414
new MessageTemplate(new[] {new TextToken("Hello")}), new LogEventProperty[0]);
1515

16-
private readonly SignallingSink _signal;
17-
private Logger _syncLogger, _asyncLogger;
16+
readonly SignallingSink _signal;
17+
Logger _syncLogger, _asyncLogger;
1818

1919
public ThroughputBenchmark()
2020
{
2121
_signal = new SignallingSink(Count);
2222
}
2323

24-
[Setup]
24+
[GlobalSetup]
2525
public void Reset()
2626
{
2727
_syncLogger?.Dispose();

test/Serilog.Sinks.Async.Tests/BackgroundWorkerSinkIntegrationSpec.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class BackgroundWorkerSinkIntegrationSpec
1515
/// <summary>
1616
/// If <see cref="withDelay" />, then adds a 1sec delay before every fifth element created
1717
/// </summary>
18-
private static void CreateAudits(ILogger logger, int count, bool withDelay)
18+
static void CreateAudits(ILogger logger, int count, bool withDelay)
1919
{
2020
var delay = TimeSpan.FromMilliseconds(1000);
2121
var sw = new Stopwatch();
@@ -47,7 +47,7 @@ private static void CreateAudits(ILogger logger, int count, bool withDelay)
4747
}
4848
}
4949

50-
private static List<LogEvent> RetrieveEvents(MemorySink sink, int count)
50+
static List<LogEvent> RetrieveEvents(MemorySink sink, int count)
5151
{
5252
Debug.WriteLine("{0:h:mm:ss tt} Retrieving {1} events", DateTime.Now, count);
5353

@@ -91,9 +91,9 @@ public GivenBufferQueueAndDelays()
9191

9292
public abstract class SinkSpecBase : IDisposable
9393
{
94-
private bool _delayCreation;
95-
private Logger _logger;
96-
private MemorySink _memorySink;
94+
bool _delayCreation;
95+
Logger _logger;
96+
MemorySink _memorySink;
9797

9898
protected SinkSpecBase(bool useBufferedQueue, bool delayCreation)
9999
{

test/Serilog.Sinks.Async.Tests/BackgroundWorkerSinkSpec.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,12 @@ public void MonitorParameterAffordsSinkInspectorSuitableForHealthChecking()
230230
Assert.Null(monitor.Inspector);
231231
}
232232

233-
private BackgroundWorkerSink CreateSinkWithDefaultOptions()
233+
BackgroundWorkerSink CreateSinkWithDefaultOptions()
234234
{
235235
return new BackgroundWorkerSink(_logger, 10000, false);
236236
}
237237

238-
private static LogEvent CreateEvent()
238+
static LogEvent CreateEvent()
239239
{
240240
return new LogEvent(DateTimeOffset.MaxValue, LogEventLevel.Error, null,
241241
new MessageTemplate("amessage", Enumerable.Empty<MessageTemplateToken>()),

test/Serilog.Sinks.Async.Tests/Serilog.Sinks.Async.Tests.csproj

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net452;netcoreapp1.0</TargetFrameworks>
4+
<TargetFrameworks>net461;netcoreapp2.0</TargetFrameworks>
55
<AssemblyName>Serilog.Sinks.Async.Tests</AssemblyName>
66
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile>
77
<SignAssembly>true</SignAssembly>
@@ -14,9 +14,12 @@
1414
</ItemGroup>
1515

1616
<ItemGroup>
17-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
18-
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
19-
<PackageReference Include="xunit" Version="2.3.1" />
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
18+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
19+
<PrivateAssets>all</PrivateAssets>
20+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
21+
</PackageReference>
22+
<PackageReference Include="xunit" Version="2.4.1" />
2023
</ItemGroup>
2124

2225
<ItemGroup>

0 commit comments

Comments
 (0)