changed LoggerExtensions
This commit is contained in:
parent
5f7aface7b
commit
fa43c1877e
@ -2,7 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<!--package info-->
|
||||
<PackageId>DTLib.Logging</PackageId>
|
||||
<Version>1.0.2</Version>
|
||||
<Version>1.0.3</Version>
|
||||
<Authors>Timerix</Authors>
|
||||
<Description>Loggers with dependency injection</Description>
|
||||
<RepositoryType>GIT</RepositoryType>
|
||||
|
||||
@ -28,12 +28,17 @@ public class LoggerContext
|
||||
public void LogWarn(object message)
|
||||
=> Logger.LogWarn(Context, message);
|
||||
|
||||
/// uses Ben.Demystifier to serialize exception
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void LogWarn(Exception ex)
|
||||
=> Logger.LogWarn(Context, ex);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void LogError(object message)
|
||||
=> Logger.LogError(Context, message);
|
||||
|
||||
/// uses Ben.Demystifier to serialize exception
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void LogException(Exception ex)
|
||||
=> Logger.LogException(Context, ex);
|
||||
public void LogError(Exception ex)
|
||||
=> Logger.LogError(Context, ex);
|
||||
}
|
||||
@ -22,6 +22,11 @@ public static class LoggerExtensions
|
||||
public static void LogWarn(this ILogger logger, string context, object message)
|
||||
=> logger.Log(context, LogSeverity.Warn, message);
|
||||
|
||||
/// uses Ben.Demystifier to serialize exception
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void LogWarn(this ILogger logger, string context, Exception ex)
|
||||
=> logger.Log(context, LogSeverity.Warn, ex.ToStringDemystified());
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void LogError(this ILogger logger, string context, object message)
|
||||
=> logger.Log(context, LogSeverity.Error, message);
|
||||
@ -29,6 +34,6 @@ public static class LoggerExtensions
|
||||
|
||||
/// uses Ben.Demystifier to serialize exception
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void LogException(this ILogger logger, string context, Exception ex)
|
||||
=> logger.Log(context, LogSeverity.Error, ex.Demystify());
|
||||
public static void LogError(this ILogger logger, string context, Exception ex)
|
||||
=> logger.Log(context, LogSeverity.Error, ex.ToStringDemystified());
|
||||
}
|
||||
@ -28,7 +28,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)' != 'Debug' ">
|
||||
<PackageReference Include="DTLib.Network" Version="1.0.2" />
|
||||
<PackageReference Include="DTLib.Logging" Version="1.0.2" />
|
||||
<PackageReference Include="DTLib.Logging" Version="1.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--project files-->
|
||||
|
||||
@ -33,7 +33,7 @@ public static class Program
|
||||
TestDtsodV24.TestAll();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{ NewLogger.LogException("Main", ex); }
|
||||
{ NewLogger.LogError("Main", ex); }
|
||||
Console.ResetColor();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user