This commit is contained in:
Anton Suhorukov 2022-05-06 10:58:15 +03:00
parent 0b63b5eba6
commit 92c6844810
8 changed files with 14 additions and 12 deletions

View File

@ -244,6 +244,8 @@ csharp_style_prefer_extended_property_pattern = true:suggestion
dotnet_diagnostic.CA1001.severity = warning
dotnet_diagnostic.CA1805.severity = warning
dotnet_diagnostic.CA1841.severity = warning
dotnet_diagnostic.SYSLIB1006.severity = silent
dotnet_diagnostic.SYSLIB1015.severity = silent
[*.{cs,vb}]
dotnet_style_operator_placement_when_wrapping = beginning_of_line

View File

@ -25,10 +25,10 @@
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Common.Log;
internal static partial class CommonLogger
public static partial class CommonLogger
{
[LoggerMessage(Level = LogLevel.Error)]
public static partial void Error(this ILogger logger, Exception exception, string message);
public static partial void ErrorWithException(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Debug)]
public static partial void Debug(this ILogger logger, string message);

View File

@ -87,7 +87,7 @@ public class BaseCommonLinkUtility
}
catch (Exception error)
{
options.CreateLogger("ASC.Web").Error(error, error.Message);
options.CreateLogger("ASC.Web").ErrorWithException(error);
}
}

View File

@ -98,7 +98,7 @@ public class CouponManager : IDisposable
}
catch (Exception ex)
{
_logger.Error(ex, ex.Message);
_logger.ErrorWithException(ex);
throw;
}
}
@ -138,7 +138,7 @@ public class CouponManager : IDisposable
}
catch (Exception ex)
{
_logger.Error(ex, ex.Message);
_logger.ErrorWithException(ex);
throw;
}
@ -244,7 +244,7 @@ class Promotion
}
catch (Exception ex)
{
log.Error(ex, ex.Message);
log.ErrorWithException(ex);
throw;
}

View File

@ -286,11 +286,11 @@ public class LicenseReader
{
if (_logger.IsEnabled(LogLevel.Debug))
{
_logger.Error(error, error.Message);
_logger.ErrorWithException(error);
}
else
{
_logger.Error(error.Message);
_logger.ErrorWithException(error);
}
}
}

View File

@ -701,7 +701,7 @@ public class TariffService : ITariffService
{
if (Logger.IsEnabled(LogLevel.Debug))
{
Logger.ErrorBilling(tenantId, error);
Logger.ErrorBillingWithException(tenantId, error);
}
else
{

View File

@ -80,7 +80,7 @@ public class DBResourceManager : ResourceManager
}
catch (Exception err)
{
log.CanNotGetExportedTypes(a.FullName, nameof(a.GetExportedTypes), rtle);
log.CanNotGetExportedTypes(a.FullName, nameof(a.GetExportedTypes), err);
}
}
foreach (var type in types)
@ -286,7 +286,7 @@ public class WhiteLabelHelper
}
catch (Exception e)
{
_logger.RestoreOldText(e);
_logger.ErrorRestoreOldText(e);
}
}

View File

@ -40,7 +40,7 @@ internal static partial class TariffServiceLogger
public static partial void ErrorLoaderExceptions(this ILogger logger, string text, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Billing tenant {tenantId}")]
public static partial void ErrorBilling(this ILogger logger, string tenantId, Exception exception);
public static partial void ErrorBillingWithException(this ILogger logger, string tenantId, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Billing tenant {tenantId}: {message}")]
public static partial void ErrorBilling(this ILogger logger, string tenantId, string message);