forked from agentic-review-benchmarks/aspnetcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBatchingLoggerOptions.cs
More file actions
86 lines (78 loc) · 2.64 KB
/
BatchingLoggerOptions.cs
File metadata and controls
86 lines (78 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
namespace Microsoft.Extensions.Logging.AzureAppServices;
/// <summary>
/// Specifies options for a logger that batches log messages.
/// </summary>
public class BatchingLoggerOptions
{
private int? _batchSize;
private int? _backgroundQueueSize = 1000;
private TimeSpan _flushPeriod = TimeSpan.FromSeconds(1);
/// <summary>
/// Gets or sets the period after which logs will be flushed to the store.
/// </summary>
public TimeSpan FlushPeriod
{
get { return _flushPeriod; }
set
{
if (value <= TimeSpan.Zero)
{
throw new ArgumentOutOfRangeException(nameof(value), $"{nameof(FlushPeriod)} must be positive.");
}
_flushPeriod = value;
}
}
/// <summary>
/// Gets or sets the maximum size of the background log message queue, or null for no limit.
/// </summary>
/// <value>
/// The maximum size of the background log message queue, or <see langword="null" /> for no limit. The default is 1000.
/// </value>
/// <remarks>
/// After the maximum queue size is reached, the log event sink starts blocking.
/// </remarks>
public int? BackgroundQueueSize
{
get { return _backgroundQueueSize; }
set
{
if (value <= 0)
{
throw new ArgumentOutOfRangeException(nameof(value), $"{nameof(BackgroundQueueSize)} must be non-negative.");
}
_backgroundQueueSize = value;
}
}
/// <summary>
/// Gets or sets the maximum number of events to include in a single batch.
/// </summary>
/// <value>
/// The maximum number of events to include in a single batch, or <see langword="null" /> for no limit. The default is <see langword="null" />.
/// </value>
public int? BatchSize
{
get { return _batchSize; }
set
{
if (value <= 0)
{
throw new ArgumentOutOfRangeException(nameof(value), $"{nameof(BatchSize)} must be positive.");
}
_batchSize = value;
}
}
/// <summary>
/// Gets or sets a value indicating whether the logger accepts and queues writes.
/// </summary>
public bool IsEnabled { get; set; }
/// <summary>
/// Gets or sets a value indicating whether scopes should be included in the message.
/// </summary>
/// <value>
/// The default is <see langword="false" />.
/// </value>
public bool IncludeScopes { get; set; }
}