Skip to content

Commit

Permalink
Merge pull request #137 from a-jackson/netstandard20-support
Browse files Browse the repository at this point in the history
Add support for netstandard2.0
  • Loading branch information
wparad authored May 20, 2024
2 parents 8bcf04e + 360c0c1 commit 4d0a7a8
Show file tree
Hide file tree
Showing 4 changed files with 301 additions and 295 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static LoggerConfiguration AmazonCloudWatch(this LoggerSinkConfiguration
// the batched sink is
var batchedSink = new PeriodicBatchingSinkImplementationCallback(cloudWatchClient, options);

var sink = new PeriodicBatchingSink(batchedSink, new()
var sink = new PeriodicBatchingSink(batchedSink, new PeriodicBatchingSinkOptions()
{
BatchSizeLimit = options.BatchSizeLimit,
Period = options.Period,
Expand Down
9 changes: 7 additions & 2 deletions src/Serilog.Sinks.AwsCloudWatch/CloudWatchLogSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ namespace Serilog.Sinks.AwsCloudWatch
/// <summary>
/// A Serilog log sink that publishes to AWS CloudWatch Logs
/// </summary>
public class CloudWatchLogSink : ILogEventSink, IDisposable, IAsyncDisposable
public class CloudWatchLogSink : ILogEventSink, IDisposable
#if NET6_0_OR_GREATER
, IAsyncDisposable
#endif
{
private readonly PeriodicBatchingSink batchingSink;

Expand Down Expand Up @@ -52,7 +55,7 @@ public class CloudWatchLogSink : ILogEventSink, IDisposable, IAsyncDisposable
public CloudWatchLogSink(IAmazonCloudWatchLogs cloudWatchClient, ICloudWatchSinkOptions options)
{
var batchedSink = new PeriodicBatchingSinkImplementationCallback(cloudWatchClient, options);
batchingSink = new(batchedSink, new() { BatchSizeLimit = options.BatchSizeLimit, Period = options.Period, QueueLimit = options.QueueSizeLimit });
batchingSink = new PeriodicBatchingSink(batchedSink, new PeriodicBatchingSinkOptions() { BatchSizeLimit = options.BatchSizeLimit, Period = options.Period, QueueLimit = options.QueueSizeLimit });
}

/// <inheritdoc/>
Expand All @@ -67,10 +70,12 @@ public void Dispose()
batchingSink.Dispose();
}

#if NET6_0_OR_GREATER
/// <inheritdoc/>
public ValueTask DisposeAsync()
{
return batchingSink.DisposeAsync();
}
#endif
}
}
Loading

0 comments on commit 4d0a7a8

Please sign in to comment.