Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
FantasticFiasco committed Nov 6, 2021
1 parent 27d213f commit cbfde69
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions src/Serilog.Sinks.Http/LoggerSinkConfigurationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static class LoggerSinkConfigurationExtensions
/// exceeding this size will be dropped. Specify null for no limit. Default value is null.
/// </param>
/// <param name="logEventsInBatchLimit">
/// The maximum number of log events posted as a single batch over the network. Default
/// The maximum number of log events sent as a single batch over the network. Default
/// value is 1000.
/// </param>
/// <param name="batchSizeLimitBytes">
Expand All @@ -67,9 +67,9 @@ public static class LoggerSinkConfigurationExtensions
/// <para/>
/// Default value is null.
/// </param>
/// <param name="queueLimit">
/// The maximum number of events stored in the queue in memory, waiting to be posted over
/// the network. Default value is infinitely.
/// <param name="queueLimitBytes">
/// The maximum size, in bytes, of events stored in memory, waiting to be sent over the
/// network. Specify null for no limit. Default value is null.
/// </param>
/// <param name="period">
/// The time to wait between checking for event batches. Default value is 2 seconds.
Expand Down Expand Up @@ -103,7 +103,7 @@ public static LoggerConfiguration Http(
long? logEventLimitBytes = null,
int? logEventsInBatchLimit = 1000,
long? batchSizeLimitBytes = null,
int? queueLimit = null,
long? queueLimitBytes = null,
TimeSpan? period = null,
ITextFormatter? textFormatter = null,
IBatchFormatter? batchFormatter = null,
Expand All @@ -130,7 +130,7 @@ public static LoggerConfiguration Http(
logEventLimitBytes: logEventLimitBytes,
logEventsInBatchLimit: logEventsInBatchLimit,
batchSizeLimitBytes: batchSizeLimitBytes,
queueLimit: queueLimit,
queueLimitBytes: queueLimitBytes,
period: period.Value,
textFormatter: textFormatter,
batchFormatter: batchFormatter,
Expand Down Expand Up @@ -180,7 +180,7 @@ public static LoggerConfiguration Http(
/// exceeding this size will be dropped. Specify null for no limit. Default value is null.
/// </param>
/// <param name="logEventsInBatchLimit">
/// The maximum number of log events posted as a single batch over the network. Default
/// The maximum number of log events sent as a single batch over the network. Default
/// value is 1000.
/// </param>
/// <param name="batchSizeLimitBytes">
Expand Down Expand Up @@ -314,7 +314,7 @@ public static LoggerConfiguration DurableHttpUsingFileSizeRolledBuffers(
/// exceeding this size will be dropped. Specify null for no limit. Default value is null.
/// </param>
/// <param name="logEventsInBatchLimit">
/// The maximum number of log events posted as a single batch over the network. Default
/// The maximum number of log events sent as a single batch over the network. Default
/// value is 1000.
/// </param>
/// <param name="batchSizeLimitBytes">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public HttpSink(
long? logEventLimitBytes,
int? logEventsInBatchLimit,
long? batchSizeLimitBytes,
int? queueLimit,
long? queueLimitBytes,
TimeSpan period,
ITextFormatter textFormatter,
IBatchFormatter batchFormatter,
Expand All @@ -62,7 +62,7 @@ public HttpSink(

connectionSchedule = new ExponentialBackoffConnectionSchedule(period);
timer = new PortableTimer(OnTick);
queue = new LogEventQueue(queueLimit);
queue = new LogEventQueue(queueLimitBytes);

SetTimer();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ namespace Serilog.Sinks.Http.Private.NonDurable
public class LogEventQueue
{
private readonly Queue<string> queue;
private readonly int? queueLimit;
private readonly long? queueLimitBytes;
private readonly object syncRoot = new();

public LogEventQueue(int? queueLimit = null)
public LogEventQueue(long? queueLimitBytes = null)
{
if (queueLimit < 1)
throw new ArgumentException("queueLimit must be either null or greater than 0", nameof(queueLimit));
if (queueLimitBytes < 1)
throw new ArgumentException("queueLimitBytes must be either null or greater than 0", nameof(queueLimitBytes));

queue = new Queue<string>();
this.queueLimit = queueLimit;
this.queueLimitBytes = queueLimitBytes;
}

public void Enqueue(string logEvent)
Expand Down

0 comments on commit cbfde69

Please sign in to comment.