changed LoggerExtensions
This commit is contained in:
@@ -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());
|
||||
}
|
||||
Reference in New Issue
Block a user