With PeriodicBatchingSink marked as sealed, DatadogSink now cannot be constructed and will fail at runtime with an exception like this:
System.TypeLoadException: Could not load type 'Serilog.Sinks.Datadog.Logs.DatadogSink' from assembly 'Serilog.Sinks.Datadog.Logs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=a460801c7b1366bb' because the parent type is sealed.
Relevant bit from the PR referenced is reproduced here:
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).
Nuget package
Serilog.Sinks.PeriodicBatching
has dropped inheritance support forPeriodicBatchingSink
in the latest version3.0.0
. See here for commit in that repository https://github.com/serilog/serilog-sinks-periodicbatching/pull/56With
PeriodicBatchingSink
marked as sealed,DatadogSink
now cannot be constructed and will fail at runtime with an exception like this:Relevant bit from the PR referenced is reproduced here:
Thanks!