diff --git a/appveyor.yml b/appveyor.yml index d34deae..762902b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,15 +1,15 @@ version: '{build}' skip_tags: true image: Visual Studio 2022 -test: off build_script: - pwsh: ./Build.ps1 +test: off artifacts: - path: artifacts/Serilog.*.nupkg deploy: - provider: NuGet api_key: - secure: sDnchSg4TZIOK7oIUI6BJwFPNENTOZrGNsroGO1hehLJSvlHpFmpTwiX8+bgPD+Q + secure: ZpUO4ECx4c/V0Ecj04cfV1UGd+ZABeEG9DDW2fjG8vITjNYhmbiiJH0qNOnRy2G3 skip_symbols: true on: branch: /^(main|dev)$/ @@ -20,4 +20,3 @@ deploy: tag: v$(appveyor_build_version) on: branch: main - diff --git a/src/Serilog.Sinks.Email/LoggerConfigurationEmailExtensions.cs b/src/Serilog.Sinks.Email/LoggerConfigurationEmailExtensions.cs index 9e346c7..eb0faf0 100644 --- a/src/Serilog.Sinks.Email/LoggerConfigurationEmailExtensions.cs +++ b/src/Serilog.Sinks.Email/LoggerConfigurationEmailExtensions.cs @@ -21,7 +21,6 @@ using Serilog.Events; using Serilog.Formatting.Display; using Serilog.Sinks.Email; -using Serilog.Sinks.PeriodicBatching; // ReSharper disable MemberCanBePrivate.Global namespace Serilog; @@ -31,7 +30,7 @@ namespace Serilog; /// public static class LoggerConfigurationEmailExtensions { - static readonly TimeSpan DefaultPeriod = TimeSpan.FromSeconds(30); + static readonly TimeSpan DefaultBufferingTimeLimit = TimeSpan.FromSeconds(30); const int DefaultQueueLimit = 10000; /// @@ -120,17 +119,17 @@ public static LoggerConfiguration Email( public static LoggerConfiguration Email( this LoggerSinkConfiguration loggerConfiguration, EmailSinkOptions options, - PeriodicBatchingSinkOptions? batchingOptions = null, + BatchingOptions? batchingOptions = null, LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum, LoggingLevelSwitch? levelSwitch = null) { if (options == null) throw new ArgumentNullException(nameof(options)); - batchingOptions ??= new PeriodicBatchingSinkOptions + batchingOptions ??= new BatchingOptions { // Batching not used by default: fire off an email immediately upon receiving each event. BatchSizeLimit = 1, - Period = DefaultPeriod, + BufferingTimeLimit = DefaultBufferingTimeLimit, EagerlyEmitFirstEvent = true, QueueLimit = DefaultQueueLimit, }; @@ -138,9 +137,7 @@ public static LoggerConfiguration Email( var transport = new MailKitEmailTransport(options); var sink = new EmailSink(options, transport); - var batchingSink = new PeriodicBatchingSink(sink, batchingOptions); - - return loggerConfiguration.Sink(batchingSink, restrictedToMinimumLevel, levelSwitch); + return loggerConfiguration.Sink(sink, batchingOptions, restrictedToMinimumLevel, levelSwitch); } diff --git a/src/Serilog.Sinks.Email/Serilog.Sinks.Email.csproj b/src/Serilog.Sinks.Email/Serilog.Sinks.Email.csproj index 1b9e231..b71091c 100644 --- a/src/Serilog.Sinks.Email/Serilog.Sinks.Email.csproj +++ b/src/Serilog.Sinks.Email/Serilog.Sinks.Email.csproj @@ -3,8 +3,8 @@ Send Serilog events as SMTP email using MailKit. 3.0.0 Serilog Contributors - net462 - $(TargetFrameworks);netstandard2.0;net6.0 + net462;net471 + $(TargetFrameworks);netstandard2.0;net6.0;net8.0 ../../assets/Serilog.snk true true @@ -30,9 +30,8 @@ - - - + + diff --git a/src/Serilog.Sinks.Email/Sinks/Email/EmailSink.cs b/src/Serilog.Sinks.Email/Sinks/Email/EmailSink.cs index 048f7e5..73878e4 100644 --- a/src/Serilog.Sinks.Email/Sinks/Email/EmailSink.cs +++ b/src/Serilog.Sinks.Email/Sinks/Email/EmailSink.cs @@ -16,8 +16,8 @@ using System.IO; using System.Threading.Tasks; using Serilog.Events; -using Serilog.Sinks.PeriodicBatching; using System.Linq; +using Serilog.Core; namespace Serilog.Sinks.Email; @@ -41,7 +41,7 @@ public EmailSink(EmailSinkOptions options, IEmailTransport emailTransport) /// Emit a batch of log events, running asynchronously. /// /// The events to emit. - public Task EmitBatchAsync(IEnumerable events) + public Task EmitBatchAsync(IReadOnlyCollection events) { // ReSharper disable PossibleMultipleEnumeration diff --git a/test/Serilog.Sinks.Email.Tests/EmailSinkTests.cs b/test/Serilog.Sinks.Email.Tests/EmailSinkTests.cs index d5bcf58..986fa76 100644 --- a/test/Serilog.Sinks.Email.Tests/EmailSinkTests.cs +++ b/test/Serilog.Sinks.Email.Tests/EmailSinkTests.cs @@ -6,8 +6,8 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Serilog.Configuration; using Serilog.Sinks.Email.Tests.Support; -using Serilog.Sinks.PeriodicBatching; using Xunit; using Xunit.Abstractions; @@ -140,7 +140,7 @@ public void WorksWithIBatchTextFormatter() var sink = new EmailSink(emailConnectionInfo, emailTransport); using (var emailLogger = new LoggerConfiguration() - .WriteTo.Sink(new PeriodicBatchingSink(sink, new PeriodicBatchingSinkOptions())) + .WriteTo.Sink(sink, new BatchingOptions()) .CreateLogger()) { emailLogger.Information("Information"); diff --git a/test/Serilog.Sinks.Email.Tests/Serilog.Sinks.Email.Tests.csproj b/test/Serilog.Sinks.Email.Tests/Serilog.Sinks.Email.Tests.csproj index b358949..05c0e95 100644 --- a/test/Serilog.Sinks.Email.Tests/Serilog.Sinks.Email.Tests.csproj +++ b/test/Serilog.Sinks.Email.Tests/Serilog.Sinks.Email.Tests.csproj @@ -14,9 +14,9 @@ - - - + + + all runtime; build; native; contentfiles; analyzers