This commit is contained in:
Jeroen Saey
2026-01-26 06:45:05 +01:00
parent 521feac8a9
commit 123b90f559
5 changed files with 15 additions and 17 deletions

View File

@@ -23,7 +23,7 @@
</PropertyGroup>
<PropertyGroup>
<EVRevisionFormat>1.5.4+{chash:10}.{c:ymd}</EVRevisionFormat>
<EVRevisionFormat>1.5.5+{chash:10}.{c:ymd}</EVRevisionFormat>
<EVDefault>true</EVDefault>
<EVInfo>true</EVInfo>
<EVTagMatch>v[0-9]*</EVTagMatch>

View File

@@ -158,7 +158,7 @@ namespace EonaCat.Logger.EonaCatCoreLogger
}
}
private static DbParameter CreateParameter(DbCommand command, string name, object value)
private DbParameter CreateParameter(DbCommand command, string name, object value)
{
var param = command.CreateParameter();
param.ParameterName = $"@{name}";

View File

@@ -16,12 +16,12 @@ namespace EonaCat.Logger.EonaCatCoreLogger
private readonly DatabaseLoggerOptions _options;
private readonly LoggerScopedContext _context = new();
private static readonly ConcurrentQueue<LogEntry> _queue = new();
private static readonly SemaphoreSlim _flushLock = new(1, 1);
private readonly ConcurrentQueue<LogEntry> _queue = new();
private readonly SemaphoreSlim _flushLock = new(1, 1);
private static CancellationTokenSource _cts = new();
private static Task _flushTask;
private static int _refCount;
private CancellationTokenSource _cts = new();
private Task _flushTask;
private int _refCount;
private const int MaxQueueSize = 10_000;

View File

@@ -16,14 +16,13 @@ namespace EonaCat.Logger.EonaCatCoreLogger
private readonly DiscordLoggerOptions _options;
private readonly LoggerScopedContext _context = new LoggerScopedContext();
// Static shared resources
private static readonly HttpClient _httpClient = new HttpClient();
private static readonly SemaphoreSlim _flushLock = new SemaphoreSlim(1, 1);
private static readonly ConcurrentQueue<string> _messageQueue = new ConcurrentQueue<string>();
private readonly HttpClient _httpClient = new HttpClient();
private readonly SemaphoreSlim _flushLock = new SemaphoreSlim(1, 1);
private readonly ConcurrentQueue<string> _messageQueue = new ConcurrentQueue<string>();
private static bool _flushLoopStarted = false;
private static CancellationTokenSource _cts;
private static Task _flushTask;
private bool _flushLoopStarted = false;
private CancellationTokenSource _cts;
private Task _flushTask;
public bool IncludeCorrelationId { get; set; }
public event EventHandler<Exception> OnException;
@@ -157,8 +156,7 @@ namespace EonaCat.Logger.EonaCatCoreLogger
}
}
// Optional: call this on app shutdown
public static void Shutdown()
public void Shutdown()
{
_cts?.Cancel();
try

View File

@@ -171,7 +171,7 @@ namespace EonaCat.Logger.EonaCatCoreLogger
}
}
private static string ReplaceTemplate(string template, Dictionary<string, string> values)
private string ReplaceTemplate(string template, Dictionary<string, string> values)
{
foreach (var kv in values)
{