[CHANGE] Updated publish nuget commandline & updated projects target framework.
Some checks failed
Build C# Library / build (push) Failing after 1m13s
Some checks failed
Build C# Library / build (push) Failing after 1m13s
This commit is contained in:
@@ -4,13 +4,13 @@ namespace DotBased.Logging.MEL;
|
||||
|
||||
public class BasedLogger : Microsoft.Extensions.Logging.ILogger
|
||||
{
|
||||
private const string _messageTemplateKey = "{OriginalFormat}";
|
||||
private const string MessageTemplateKey = "{OriginalFormat}";
|
||||
public BasedLogger(ILogger logger)
|
||||
{
|
||||
basedLogger = logger;
|
||||
_basedLogger = logger;
|
||||
}
|
||||
|
||||
private readonly ILogger basedLogger;
|
||||
private readonly ILogger _basedLogger;
|
||||
|
||||
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
|
||||
{
|
||||
@@ -18,7 +18,7 @@ public class BasedLogger : Microsoft.Extensions.Logging.ILogger
|
||||
return;
|
||||
var severity = ConvertLogLevelToSeverity(logLevel);
|
||||
var capsule = ConstructCapsule(severity, eventId, state, exception, formatter);
|
||||
basedLogger.Log(capsule);
|
||||
_basedLogger.Log(capsule);
|
||||
}
|
||||
|
||||
private LogCapsule ConstructCapsule<TState>(LogSeverity severity, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
|
||||
@@ -29,7 +29,7 @@ public class BasedLogger : Microsoft.Extensions.Logging.ILogger
|
||||
{
|
||||
foreach (var prop in stateEnum)
|
||||
{
|
||||
if (prop is { Key: _messageTemplateKey, Value: string propValueString })
|
||||
if (prop is { Key: MessageTemplateKey, Value: string propValueString })
|
||||
{
|
||||
msgTemplate = propValueString;
|
||||
continue;
|
||||
@@ -37,16 +37,8 @@ public class BasedLogger : Microsoft.Extensions.Logging.ILogger
|
||||
templateParams.Add(prop.Value);
|
||||
}
|
||||
}
|
||||
|
||||
return new LogCapsule()
|
||||
{
|
||||
Exception = exception,
|
||||
Message = msgTemplate,
|
||||
Parameters = templateParams.ToArray(),
|
||||
Severity = severity,
|
||||
TimeStamp = DateTime.Now,
|
||||
Logger = basedLogger as LoggerBase ?? throw new NullReferenceException(nameof(basedLogger))
|
||||
};
|
||||
|
||||
return new LogCapsule(_basedLogger as LoggerBase ?? throw new NullReferenceException(nameof(_basedLogger)), severity, msgTemplate, exception, templateParams.ToArray(), DateTime.Now);
|
||||
}
|
||||
|
||||
private LogSeverity ConvertLogLevelToSeverity(LogLevel level)
|
||||
@@ -66,5 +58,5 @@ public class BasedLogger : Microsoft.Extensions.Logging.ILogger
|
||||
|
||||
public bool IsEnabled(LogLevel logLevel) => logLevel != LogLevel.None;
|
||||
|
||||
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => default;
|
||||
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => null;
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>12</LangVersion>
|
||||
|
Reference in New Issue
Block a user