Skip to content

Commit

Permalink
Merge pull request #40 from nblumhardt/default-sink-options
Browse files Browse the repository at this point in the history
Set defaults when using PeriodicBatchingSinkOptions
  • Loading branch information
nblumhardt authored Feb 16, 2020
2 parents dc13687 + 2a3d7c2 commit f6bef8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -81,7 +81,8 @@ protected PeriodicBatchingSink(int batchSizeLimit, TimeSpan period)
{
BatchSizeLimit = batchSizeLimit,
Period = period,
EagerlyEmitFirstEvent = true
EagerlyEmitFirstEvent = true,
QueueLimit = null
})
{
_batchedLogEventSink = this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@ public class PeriodicBatchingSinkOptions
/// <summary>
/// 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 <c>true</c>.
/// </summary>
public bool EagerlyEmitFirstEvent { get; set; }
public bool EagerlyEmitFirstEvent { get; set; } = true;

/// <summary>
/// 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 <c>1000</c>.
/// </summary>
public int BatchSizeLimit { get; set; }
public int BatchSizeLimit { get; set; } = 1000;

/// <summary>
/// The time to wait between checking for event batches.
/// The time to wait between checking for event batches. The default is two seconds.
/// </summary>
public TimeSpan Period { get; set; }
public TimeSpan Period { get; set; } = TimeSpan.FromSeconds(2);

/// <summary>
/// Maximum number of events to hold in the sink's internal queue, or <c>null</c>
/// for an unbounded queue.
/// for an unbounded queue. The default is <c>10000</c>.
/// </summary>
public int? QueueLimit { get; set; }
public int? QueueLimit { get; set; } = 100000;
}
}

0 comments on commit f6bef8c

Please sign in to comment.