From 2a3d7c2e9e4b5c2220db135c3618b2b006fd5b22 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Sun, 16 Feb 2020 06:16:43 +1000 Subject: [PATCH] Set defaults when using PeriodicBatchingSinkOptions --- .../PeriodicBatching/PeriodicBatchingSink.cs | 5 +++-- .../PeriodicBatchingSinkOptions.cs | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/PeriodicBatchingSink.cs b/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/PeriodicBatchingSink.cs index 266315f..b331129 100644 --- a/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/PeriodicBatchingSink.cs +++ b/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/PeriodicBatchingSink.cs @@ -20,7 +20,7 @@ using Serilog.Events; using System.Threading; -// ReSharper disable MemberCanBePrivate.Global, UnusedMember.Global, VirtualMemberNeverOverridden.Global +// ReSharper disable MemberCanBePrivate.Global, UnusedMember.Global, VirtualMemberNeverOverridden.Global, ClassWithVirtualMembersNeverInherited.Global namespace Serilog.Sinks.PeriodicBatching { @@ -81,7 +81,8 @@ protected PeriodicBatchingSink(int batchSizeLimit, TimeSpan period) { BatchSizeLimit = batchSizeLimit, Period = period, - EagerlyEmitFirstEvent = true + EagerlyEmitFirstEvent = true, + QueueLimit = null }) { _batchedLogEventSink = this; diff --git a/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/PeriodicBatchingSinkOptions.cs b/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/PeriodicBatchingSinkOptions.cs index d97b73a..d0a8fbc 100644 --- a/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/PeriodicBatchingSinkOptions.cs +++ b/src/Serilog.Sinks.PeriodicBatching/Sinks/PeriodicBatching/PeriodicBatchingSinkOptions.cs @@ -24,24 +24,24 @@ public class PeriodicBatchingSinkOptions /// /// Eagerly emit a batch containing the first received event, regardless of /// the target batch size or batching time. This helps with perceived "liveness" - /// when running/debugging applications interactively. + /// when running/debugging applications interactively. The default is true. /// - public bool EagerlyEmitFirstEvent { get; set; } + public bool EagerlyEmitFirstEvent { get; set; } = true; /// - /// The maximum number of events to include in a single batch. + /// The maximum number of events to include in a single batch. The default is 1000. /// - public int BatchSizeLimit { get; set; } + public int BatchSizeLimit { get; set; } = 1000; /// - /// The time to wait between checking for event batches. + /// The time to wait between checking for event batches. The default is two seconds. /// - public TimeSpan Period { get; set; } + public TimeSpan Period { get; set; } = TimeSpan.FromSeconds(2); /// /// Maximum number of events to hold in the sink's internal queue, or null - /// for an unbounded queue. + /// for an unbounded queue. The default is 10000. /// - public int? QueueLimit { get; set; } + public int? QueueLimit { get; set; } = 100000; } } \ No newline at end of file