Enables asynchronous flushing of queued batches when disposed via IAsyncDisposable.DisposeAsync(). Batched sinks will now also be disposed via DisposeAsync() if they support it.
The interactions of Dispose(), Dispose(bool), DisposeAsync(), and DisposeAsyncCore() make retrofitting support in a base class like PeriodicBatchingSink error-prone, opening the door to skipped disposal or double-disposal in base classes not explicitly written for async disposal.
Since subclassing of PeriodicBatchingSink was already obsoleted, this PR skips the whole unfruitful mess and simply takes the next step by removing subclassing support altogether. Major version bumped to 3.0.0.
Migrating existing code to the new API is easy - instead of deriving from PeriodicBatchingSink, consumers implement IBatchedLogEventSink instead, and wrap an instance of the batched sink in a new PeriodicBatchingSink(batchedSink, options).
Enables asynchronous flushing of queued batches when disposed via
IAsyncDisposable.DisposeAsync()
. Batched sinks will now also be disposed viaDisposeAsync()
if they support it.See also: https://github.com/serilog/serilog/pull/1750
Dropping subclassing support
The interactions of
Dispose()
,Dispose(bool)
,DisposeAsync()
, andDisposeAsyncCore()
make retrofitting support in a base class likePeriodicBatchingSink
error-prone, opening the door to skipped disposal or double-disposal in base classes not explicitly written for async disposal.Since subclassing of
PeriodicBatchingSink
was already obsoleted, this PR skips the whole unfruitful mess and simply takes the next step by removing subclassing support altogether. Major version bumped to 3.0.0.Migrating existing code to the new API is easy - instead of deriving from
PeriodicBatchingSink
, consumers implementIBatchedLogEventSink
instead, and wrap an instance of the batched sink in anew PeriodicBatchingSink(batchedSink, options)
.