Files
EonaCat.Logger/EonaCat.Logger/EonaCatCoreLogger/Internal/BatchingLoggerOptions.cs
2024-04-25 22:05:17 +02:00

35 lines
1.1 KiB
C#

using System;
namespace EonaCat.Logger.EonaCatCoreLogger.Internal;
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/License for full license details.
public class BatchingLoggerOptions
{
private TimeSpan _flushPeriod = TimeSpan.FromMilliseconds(100);
/// <summary>
/// Gets or sets the period after which logs will be flushed to the store.
/// </summary>
public TimeSpan FlushPeriod
{
get => _flushPeriod;
set
{
if (value <= TimeSpan.Zero)
throw new ArgumentOutOfRangeException(nameof(value), $"{nameof(FlushPeriod)} must be positive.");
_flushPeriod = value;
}
}
/// <summary>
/// Gets or sets a maximum number of events to include in a single batch or less than 1 for no limit.
/// </summary>
public int BatchSize { get; set; } = 0;
/// <summary>
/// Gets or sets value indicating if logger accepts and queues writes.
/// </summary>
public bool IsEnabled { get; set; }
}