diff --git a/src/Serilog.Sinks.Postgresql.Alternative/GlobalUsings.cs b/src/Serilog.Sinks.Postgresql.Alternative/GlobalUsings.cs index 05b9363..8c24136 100644 --- a/src/Serilog.Sinks.Postgresql.Alternative/GlobalUsings.cs +++ b/src/Serilog.Sinks.Postgresql.Alternative/GlobalUsings.cs @@ -13,7 +13,6 @@ global using Serilog.Debugging; global using Serilog.Events; global using Serilog.Formatting.Json; -global using Serilog.Sinks.PeriodicBatching; global using Serilog.Sinks.PostgreSQL; global using Serilog.Sinks.PostgreSQL.ColumnWriters; global using Serilog.Sinks.PostgreSQL.Configuration; diff --git a/src/Serilog.Sinks.Postgresql.Alternative/LoggerConfigurationPostgreSQLExtensions.cs b/src/Serilog.Sinks.Postgresql.Alternative/LoggerConfigurationPostgreSQLExtensions.cs index c8d5759..ae11206 100644 --- a/src/Serilog.Sinks.Postgresql.Alternative/LoggerConfigurationPostgreSQLExtensions.cs +++ b/src/Serilog.Sinks.Postgresql.Alternative/LoggerConfigurationPostgreSQLExtensions.cs @@ -109,15 +109,14 @@ public static LoggerConfiguration PostgreSQL( onCreateTableCallback, onCreateSchemaCallback); - var batchingOptions = new PeriodicBatchingSinkOptions() + var batchingOptions = new BatchingOptions() { BatchSizeLimit = optionsLocal.BatchSizeLimit, - Period = optionsLocal.Period, + BufferingTimeLimit = optionsLocal.Period, QueueLimit = optionsLocal.QueueLimit }; - var batchingSink = new PeriodicBatchingSink(new PostgreSqlSink(optionsLocal), batchingOptions); - return sinkConfiguration.Sink(batchingSink, restrictedToMinimumLevel, levelSwitch); + return sinkConfiguration.Sink(new PostgreSqlSink(optionsLocal), batchingOptions, restrictedToMinimumLevel, levelSwitch); } /// @@ -238,15 +237,14 @@ public static LoggerConfiguration PostgreSQL( onCreateTableCallback, onCreateSchemaCallback); - var batchingOptions = new PeriodicBatchingSinkOptions() + var batchingOptions = new BatchingOptions() { BatchSizeLimit = optionsLocal.BatchSizeLimit, - Period = optionsLocal.Period, + BufferingTimeLimit = optionsLocal.Period, QueueLimit = optionsLocal.QueueLimit }; - var batchingSink = new PeriodicBatchingSink(new PostgreSqlSink(optionsLocal), batchingOptions); - return sinkConfiguration.Sink(batchingSink, restrictedToMinimumLevel, levelSwitch); + return sinkConfiguration.Sink(new PostgreSqlSink(optionsLocal), batchingOptions, restrictedToMinimumLevel, levelSwitch); } columns ??= new Dictionary(); @@ -272,15 +270,14 @@ public static LoggerConfiguration PostgreSQL( onCreateTableCallback, onCreateSchemaCallback); - var batchingOptions2 = new PeriodicBatchingSinkOptions() + var batchingOptions2 = new BatchingOptions() { BatchSizeLimit = optionsLocal2.BatchSizeLimit, - Period = optionsLocal2.Period, + BufferingTimeLimit = optionsLocal2.Period, QueueLimit = optionsLocal2.QueueLimit }; - var batchingSink2 = new PeriodicBatchingSink(new PostgreSqlSink(optionsLocal2), batchingOptions2); - return sinkConfiguration.Sink(batchingSink2, restrictedToMinimumLevel, levelSwitch); + return sinkConfiguration.Sink(new PostgreSqlSink(optionsLocal2), batchingOptions2, restrictedToMinimumLevel, levelSwitch); } /// diff --git a/src/Serilog.Sinks.Postgresql.Alternative/Sinks/PostgreSQL/PostgreSQLAuditSink.cs b/src/Serilog.Sinks.Postgresql.Alternative/Sinks/PostgreSQL/PostgreSQLAuditSink.cs index 5706c0b..4cd7cad 100644 --- a/src/Serilog.Sinks.Postgresql.Alternative/Sinks/PostgreSQL/PostgreSQLAuditSink.cs +++ b/src/Serilog.Sinks.Postgresql.Alternative/Sinks/PostgreSQL/PostgreSQLAuditSink.cs @@ -23,7 +23,6 @@ public class PostgreSqlAuditSink : ILogEventSink, IDisposable /// private readonly SinkHelper sinkHelper; - /// /// /// Initializes a new instance of the class. /// @@ -39,7 +38,7 @@ public PostgreSqlAuditSink(PostgreSqlOptions options) /// a log event to emit public async void Emit(LogEvent logEvent) { - await this.sinkHelper.Emit(new List { logEvent }); + await this.sinkHelper.Emit([logEvent]); } /// diff --git a/src/Serilog.Sinks.Postgresql.Alternative/Sinks/PostgreSQL/PostgreSQLSink.cs b/src/Serilog.Sinks.Postgresql.Alternative/Sinks/PostgreSQL/PostgreSQLSink.cs index 46ded47..1c54a63 100644 --- a/src/Serilog.Sinks.Postgresql.Alternative/Sinks/PostgreSQL/PostgreSQLSink.cs +++ b/src/Serilog.Sinks.Postgresql.Alternative/Sinks/PostgreSQL/PostgreSQLSink.cs @@ -39,10 +39,10 @@ public PostgreSqlSink(PostgreSqlOptions options) /// /// Received failed result {result.StatusCode} when posting events to Microsoft Teams /// - /// Override either or , + /// Override either or , /// not both. Overriding EmitBatch() is preferred. /// - public async Task EmitBatchAsync(IEnumerable events) + public async Task EmitBatchAsync(IReadOnlyCollection events) { try {