This commit is contained in:
jsaey
2024-04-25 10:39:55 +02:00
parent 25b959f75a
commit 44468ae920
2 changed files with 16 additions and 4 deletions

View File

@@ -12,7 +12,7 @@ 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 abstract class BatchingLoggerProvider : ILoggerProvider
public abstract class BatchingLoggerProvider : ILoggerProvider, IDisposable
{
protected DateTimeOffset CurrentDateTimeOffset => UseLocalTime ? DateTimeOffset.Now : DateTimeOffset.UtcNow;
protected DateTime CurrentDateTme => UseLocalTime ? DateTime.Now : DateTime.UtcNow;
@@ -144,9 +144,13 @@ namespace EonaCat.Logger.EonaCatCoreLogger.Internal
public void Dispose()
{
#pragma warning disable CS4014
StopAsync();
#pragma warning restore CS4014
while (!_messageQueue.IsEmpty)
{
_messageQueue.TryDequeue(out _);
}
StopAsync().GetAwaiter().GetResult();
GC.SuppressFinalize(this);
}