diff --git a/appveyor.yml b/appveyor.yml
index 0e93876..9f03018 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,7 +1,6 @@
version: '{build}'
skip_tags: true
-image: Visual Studio 2017
-configuration: Release
+image: Visual Studio 2019
build_script:
- ps: ./Build.ps1
test: off
@@ -10,7 +9,7 @@ artifacts:
deploy:
- provider: NuGet
api_key:
- secure: bd9z4P73oltOXudAjPehwp9iDKsPtC+HbgshOrSgoyQKr5xVK+bxJQngrDJkHdY8
+ secure: mnSqLheecloK/7XS+OjiDMlttTzhMTRyT2e9AUnS7aHR5AimjOD9vQtfodwagacH
skip_symbols: true
on:
branch: /^(master|dev)$/
diff --git a/serilog-sinks-async.sln.DotSettings b/serilog-sinks-async.sln.DotSettings
new file mode 100644
index 0000000..bfd92fd
--- /dev/null
+++ b/serilog-sinks-async.sln.DotSettings
@@ -0,0 +1,2 @@
+
+ True
\ No newline at end of file
diff --git a/src/Serilog.Sinks.Async/Serilog.Sinks.Async.csproj b/src/Serilog.Sinks.Async/Serilog.Sinks.Async.csproj
index 0810cbd..382912f 100644
--- a/src/Serilog.Sinks.Async/Serilog.Sinks.Async.csproj
+++ b/src/Serilog.Sinks.Async/Serilog.Sinks.Async.csproj
@@ -2,10 +2,10 @@
Asynchronous sink wrapper for Serilog.
- 1.0.0
- 1.3.0
+ 1.4.0.0
+ 1.4.0
Jezz Santos;Serilog Contributors
- net45;netstandard1.1
+ net45;netstandard1.1;net461;netstandard2.0
true
true
Serilog.Sinks.Async
@@ -15,22 +15,24 @@
true
Serilog.Sinks.Async
serilog;async
- http://serilog.net/images/serilog-sink-nuget.png
+ https://serilog.net/images/serilog-sink-nuget.png
https://serilog.net
- http://www.apache.org/licenses/LICENSE-2.0
+ Apache-2.0
+ https://github.com/serilog/serilog-sinks-async
+ git
True
-
+
true
-
+
-
+
diff --git a/src/Serilog.Sinks.Async/Sinks/Async/BackgroundWorkerSink.cs b/src/Serilog.Sinks.Async/Sinks/Async/BackgroundWorkerSink.cs
index b77f32b..a27f878 100644
--- a/src/Serilog.Sinks.Async/Sinks/Async/BackgroundWorkerSink.cs
+++ b/src/Serilog.Sinks.Async/Sinks/Async/BackgroundWorkerSink.cs
@@ -10,7 +10,7 @@ namespace Serilog.Sinks.Async
{
sealed class BackgroundWorkerSink : ILogEventSink, IAsyncLogEventSinkInspector, IDisposable
{
- readonly ILogEventSink _pipeline;
+ readonly ILogEventSink _wrappedSink;
readonly bool _blockWhenFull;
readonly BlockingCollection _queue;
readonly Task _worker;
@@ -18,10 +18,10 @@ sealed class BackgroundWorkerSink : ILogEventSink, IAsyncLogEventSinkInspector,
long _droppedMessages;
- public BackgroundWorkerSink(ILogEventSink pipeline, int bufferCapacity, bool blockWhenFull, IAsyncLogEventSinkMonitor monitor = null)
+ public BackgroundWorkerSink(ILogEventSink wrappedSink, int bufferCapacity, bool blockWhenFull, IAsyncLogEventSinkMonitor monitor = null)
{
if (bufferCapacity <= 0) throw new ArgumentOutOfRangeException(nameof(bufferCapacity));
- _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline));
+ _wrappedSink = wrappedSink ?? throw new ArgumentNullException(nameof(wrappedSink));
_blockWhenFull = blockWhenFull;
_queue = new BlockingCollection(bufferCapacity);
_worker = Task.Factory.StartNew(Pump, CancellationToken.None, TaskCreationOptions.LongRunning | TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);
@@ -64,7 +64,7 @@ public void Dispose()
// Allow queued events to be flushed
_worker.Wait();
- (_pipeline as IDisposable)?.Dispose();
+ (_wrappedSink as IDisposable)?.Dispose();
_monitor?.StopMonitoring(this);
}
@@ -75,12 +75,19 @@ void Pump()
{
foreach (var next in _queue.GetConsumingEnumerable())
{
- _pipeline.Emit(next);
+ try
+ {
+ _wrappedSink.Emit(next);
+ }
+ catch (Exception ex)
+ {
+ SelfLog.WriteLine("{0} failed to emit event to wrapped sink: {1}", typeof(BackgroundWorkerSink), ex);
+ }
}
}
- catch (Exception ex)
+ catch (Exception fatal)
{
- SelfLog.WriteLine("{0} fatal error in worker thread: {1}", typeof(BackgroundWorkerSink), ex);
+ SelfLog.WriteLine("{0} fatal error in worker thread: {1}", typeof(BackgroundWorkerSink), fatal);
}
}
diff --git a/test/Serilog.Sinks.Async.PerformanceTests/LatencyBenchmark.cs b/test/Serilog.Sinks.Async.PerformanceTests/LatencyBenchmark.cs
index 40b6d72..adaacea 100644
--- a/test/Serilog.Sinks.Async.PerformanceTests/LatencyBenchmark.cs
+++ b/test/Serilog.Sinks.Async.PerformanceTests/LatencyBenchmark.cs
@@ -11,17 +11,17 @@ namespace Serilog.Sinks.Async.PerformanceTests
{
public class LatencyBenchmark
{
- private readonly LogEvent _evt = new LogEvent(DateTimeOffset.Now, LogEventLevel.Information, null,
+ readonly LogEvent _evt = new LogEvent(DateTimeOffset.Now, LogEventLevel.Information, null,
new MessageTemplate(new[] {new TextToken("Hello")}), new LogEventProperty[0]);
- private Logger _syncLogger, _asyncLogger, _fileLogger, _asyncFileLogger;
+ Logger _syncLogger, _asyncLogger, _fileLogger, _asyncFileLogger;
static LatencyBenchmark()
{
SelfLog.Enable(new TerminatingTextWriter());
}
- [Setup]
+ [GlobalSetup]
public void Reset()
{
foreach (var logger in new[] { _syncLogger, _asyncLogger, _fileLogger, _asyncFileLogger})
diff --git a/test/Serilog.Sinks.Async.PerformanceTests/Serilog.Sinks.Async.PerformanceTests.csproj b/test/Serilog.Sinks.Async.PerformanceTests/Serilog.Sinks.Async.PerformanceTests.csproj
index 54ec36f..ffe0d1d 100644
--- a/test/Serilog.Sinks.Async.PerformanceTests/Serilog.Sinks.Async.PerformanceTests.csproj
+++ b/test/Serilog.Sinks.Async.PerformanceTests/Serilog.Sinks.Async.PerformanceTests.csproj
@@ -1,7 +1,7 @@
- net46;netcoreapp1.1
+ net461;netcoreapp2.0
Serilog.Sinks.Async.PerformanceTests
../../assets/Serilog.snk
true
@@ -17,10 +17,13 @@
-
-
-
-
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
+
diff --git a/test/Serilog.Sinks.Async.PerformanceTests/SignallingSink.cs b/test/Serilog.Sinks.Async.PerformanceTests/SignallingSink.cs
index a58e22b..2882227 100644
--- a/test/Serilog.Sinks.Async.PerformanceTests/SignallingSink.cs
+++ b/test/Serilog.Sinks.Async.PerformanceTests/SignallingSink.cs
@@ -5,11 +5,11 @@
namespace Serilog.Sinks.Async.PerformanceTests
{
- internal class SignallingSink : ILogEventSink
+ class SignallingSink : ILogEventSink
{
- private readonly int _expectedCount;
- private readonly ManualResetEvent _wh;
- private int _current;
+ readonly int _expectedCount;
+ readonly ManualResetEvent _wh;
+ int _current;
public SignallingSink(int expectedCount)
{
diff --git a/test/Serilog.Sinks.Async.PerformanceTests/ThroughputBenchmark.cs b/test/Serilog.Sinks.Async.PerformanceTests/ThroughputBenchmark.cs
index 5882197..f527e1e 100644
--- a/test/Serilog.Sinks.Async.PerformanceTests/ThroughputBenchmark.cs
+++ b/test/Serilog.Sinks.Async.PerformanceTests/ThroughputBenchmark.cs
@@ -8,20 +8,20 @@ namespace Serilog.Sinks.Async.PerformanceTests
{
public class ThroughputBenchmark
{
- private const int Count = 10000;
+ const int Count = 10000;
- private readonly LogEvent _evt = new LogEvent(DateTimeOffset.Now, LogEventLevel.Information, null,
+ readonly LogEvent _evt = new LogEvent(DateTimeOffset.Now, LogEventLevel.Information, null,
new MessageTemplate(new[] {new TextToken("Hello")}), new LogEventProperty[0]);
- private readonly SignallingSink _signal;
- private Logger _syncLogger, _asyncLogger;
+ readonly SignallingSink _signal;
+ Logger _syncLogger, _asyncLogger;
public ThroughputBenchmark()
{
_signal = new SignallingSink(Count);
}
- [Setup]
+ [GlobalSetup]
public void Reset()
{
_syncLogger?.Dispose();
diff --git a/test/Serilog.Sinks.Async.Tests/BackgroundWorkerSinkIntegrationSpec.cs b/test/Serilog.Sinks.Async.Tests/BackgroundWorkerSinkIntegrationSpec.cs
index 14c0441..23a937e 100644
--- a/test/Serilog.Sinks.Async.Tests/BackgroundWorkerSinkIntegrationSpec.cs
+++ b/test/Serilog.Sinks.Async.Tests/BackgroundWorkerSinkIntegrationSpec.cs
@@ -15,7 +15,7 @@ public class BackgroundWorkerSinkIntegrationSpec
///
/// If , then adds a 1sec delay before every fifth element created
///
- private static void CreateAudits(ILogger logger, int count, bool withDelay)
+ static void CreateAudits(ILogger logger, int count, bool withDelay)
{
var delay = TimeSpan.FromMilliseconds(1000);
var sw = new Stopwatch();
@@ -47,7 +47,7 @@ private static void CreateAudits(ILogger logger, int count, bool withDelay)
}
}
- private static List RetrieveEvents(MemorySink sink, int count)
+ static List RetrieveEvents(MemorySink sink, int count)
{
Debug.WriteLine("{0:h:mm:ss tt} Retrieving {1} events", DateTime.Now, count);
@@ -91,9 +91,9 @@ public GivenBufferQueueAndDelays()
public abstract class SinkSpecBase : IDisposable
{
- private bool _delayCreation;
- private Logger _logger;
- private MemorySink _memorySink;
+ bool _delayCreation;
+ Logger _logger;
+ MemorySink _memorySink;
protected SinkSpecBase(bool useBufferedQueue, bool delayCreation)
{
diff --git a/test/Serilog.Sinks.Async.Tests/BackgroundWorkerSinkSpec.cs b/test/Serilog.Sinks.Async.Tests/BackgroundWorkerSinkSpec.cs
index 5b5876d..dff5d5d 100644
--- a/test/Serilog.Sinks.Async.Tests/BackgroundWorkerSinkSpec.cs
+++ b/test/Serilog.Sinks.Async.Tests/BackgroundWorkerSinkSpec.cs
@@ -230,12 +230,12 @@ public void MonitorParameterAffordsSinkInspectorSuitableForHealthChecking()
Assert.Null(monitor.Inspector);
}
- private BackgroundWorkerSink CreateSinkWithDefaultOptions()
+ BackgroundWorkerSink CreateSinkWithDefaultOptions()
{
return new BackgroundWorkerSink(_logger, 10000, false);
}
- private static LogEvent CreateEvent()
+ static LogEvent CreateEvent()
{
return new LogEvent(DateTimeOffset.MaxValue, LogEventLevel.Error, null,
new MessageTemplate("amessage", Enumerable.Empty()),
diff --git a/test/Serilog.Sinks.Async.Tests/Serilog.Sinks.Async.Tests.csproj b/test/Serilog.Sinks.Async.Tests/Serilog.Sinks.Async.Tests.csproj
index 8b7a497..36f324b 100644
--- a/test/Serilog.Sinks.Async.Tests/Serilog.Sinks.Async.Tests.csproj
+++ b/test/Serilog.Sinks.Async.Tests/Serilog.Sinks.Async.Tests.csproj
@@ -1,7 +1,7 @@
- net452;netcoreapp1.0
+ net461;netcoreapp2.0
Serilog.Sinks.Async.Tests
../../assets/Serilog.snk
true
@@ -14,9 +14,12 @@
-
-
-
+
+
+ all
+ runtime; build; native; contentfiles; analyzers
+
+