Updated packages

This commit is contained in:
2023-06-26 19:07:27 +02:00
parent a592aabef1
commit 478aa15b4f
15 changed files with 92 additions and 103 deletions

View File

@@ -1,9 +1,6 @@
using EonaCat.logger.Managers;
using EonaCat.Logger.Exceptions;
using EonaCat.Logger.Extensions;
using EonaCat.Logger.Exceptions;
using EonaCat.Logger.Helpers;
using EonaCat.Logger.Syslog;
using EonaCatLogger.EonaCatCoreLogger.Models;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
@@ -11,6 +8,9 @@ using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using EonaCat.Logger.EonaCatCoreLogger;
using EonaCat.Logger.EonaCatCoreLogger.Extensions;
using EonaCat.Logger.EonaCatCoreLogger.Models;
namespace EonaCat.Logger.Managers
{
@@ -37,8 +37,8 @@ namespace EonaCat.Logger.Managers
private bool _disposed;
private static LogManager _instance;
private LoggerSettings _settings;
private CancellationTokenSource _TokenSource = new CancellationTokenSource();
private CancellationToken _Token;
private readonly CancellationTokenSource _tokenSource = new CancellationTokenSource();
private CancellationToken _token;
/// <summary>
/// Default Logger Instance with it's default configuration
@@ -84,7 +84,7 @@ namespace EonaCat.Logger.Managers
if (disposing)
{
StopLogging();
_TokenSource.Cancel();
_tokenSource.Cancel();
}
_disposed = true;
@@ -92,7 +92,7 @@ namespace EonaCat.Logger.Managers
private void StartNewLog()
{
if (_TokenSource.IsCancellationRequested)
if (_tokenSource.IsCancellationRequested)
{
return;
}
@@ -180,7 +180,7 @@ namespace EonaCat.Logger.Managers
Write(dateTime, remainder, logType, writeToConsole);
}
var EonaCatMessage = new EonaCatLogMessage
var logMessage = new EonaCatLogMessage
{
DateTime = dateTime,
Message = currentMessage,
@@ -189,11 +189,11 @@ namespace EonaCat.Logger.Managers
if (Settings != null)
{
EonaCatMessage.Origin = string.IsNullOrWhiteSpace(Settings.LogOrigin) ? "LogManager" : Settings.LogOrigin;
Settings?.OnLogEvent(EonaCatMessage);
logMessage.Origin = string.IsNullOrWhiteSpace(Settings.LogOrigin) ? "LogManager" : Settings.LogOrigin;
Settings?.OnLogEvent(logMessage);
}
Settings?.OnLogEvent(EonaCatMessage);
Settings?.OnLogEvent(logMessage);
}
public void Reset() => Settings?.ResetLogEvent();
@@ -252,7 +252,7 @@ namespace EonaCat.Logger.Managers
private void SetupLogManager()
{
_Token = _TokenSource.Token;
_token = _tokenSource.Token;
AppDomain.CurrentDomain.ProcessExit += ProcessExit;
Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPress);
@@ -274,7 +274,7 @@ namespace EonaCat.Logger.Managers
{
IsRunning = false;
Write(DateTime.Now, $"{DllInfo.ApplicationName} stopped.");
Task.Delay(500);
Task.Delay(500, _token);
}
public LogManager(string logFolder = null, bool defaultPrefix = true)