This commit is contained in:
2023-02-06 10:17:50 +01:00
parent b45e24da11
commit 4c13481e68
5 changed files with 10 additions and 21 deletions

View File

@@ -20,7 +20,5 @@
internal static string VERSION_NAME { get; }
public static string ApplicationName { get; internal set; } = "EonaCatLogger";
public static ELogType LogLevel { get; internal set; } = ELogType.INFO;
}
}

View File

@@ -9,7 +9,7 @@
net7.0;
</TargetFrameworks>
<ApplicationIcon>icon.ico</ApplicationIcon>
<Version>1.0.6</Version>
<Version>1.0.7</Version>
<Authors>EonaCat (Jeroen Saey)</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Company>EonaCat (Jeroen Saey)</Company>

View File

@@ -3,7 +3,6 @@ using EonaCat.Logger.Managers;
using EonaCatLogger.EonaCatCoreLogger.Models;
using Microsoft.Extensions.Logging;
using System;
using System.Runtime;
namespace EonaCat.Logger.Internal
{

View File

@@ -2,6 +2,6 @@
{
public interface ILogManager
{
void Write(string message, ELogType logType = ELogType.INFO, ELogType? logLevel = null, bool? writeToConsole = null);
void Write(string message, ELogType logType = ELogType.INFO, bool? writeToConsole = null);
}
}

View File

@@ -290,34 +290,26 @@ namespace EonaCat.Logger.Managers
public void Write(Exception exception, string module = null, string method = null, bool criticalException = false, bool? writeToConsole = null)
{
if (exception == null) return;
Write(exception.FormatExceptionToMessage(module, method), criticalException ? ELogType.CRITICAL : ELogType.ERROR, null, writeToConsole);
Write(exception.FormatExceptionToMessage(module, method), criticalException ? ELogType.CRITICAL : ELogType.ERROR, writeToConsole);
}
public void Write(string message, ELogType logType = ELogType.INFO, ELogType? logLevel = null, bool? writeToConsole = null)
public void Write(string message, ELogType logType = ELogType.INFO, bool? writeToConsole = null)
{
lock (_batton)
{
if (logLevel == null)
{
logLevel = DllInfo.LogLevel;
}
if (logType == ELogType.NONE)
{
return;
}
if (logType == ELogType.CRITICAL || logType <= logLevel.GetValueOrDefault())
DateTime now = DateTime.Now;
if (!IsRunning)
{
DateTime now = DateTime.Now;
if (!IsRunning)
{
StartNewLog();
}
Write(now, message, logType, writeToConsole);
StartNewLog();
}
Write(now, message, logType, writeToConsole);
}
}