diff --git a/.editorconfig b/.editorconfig index ce3b7f7fe7..276d44407d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/common/ASC.Common/Log/CommonLogger.cs b/common/ASC.Common/Log/CommonLogger.cs index 5ac60ec6bd..de6849e804 100644 --- a/common/ASC.Common/Log/CommonLogger.cs +++ b/common/ASC.Common/Log/CommonLogger.cs @@ -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); diff --git a/common/ASC.Core.Common/BaseCommonLinkUtility.cs b/common/ASC.Core.Common/BaseCommonLinkUtility.cs index 7e40920bec..8310ced778 100644 --- a/common/ASC.Core.Common/BaseCommonLinkUtility.cs +++ b/common/ASC.Core.Common/BaseCommonLinkUtility.cs @@ -87,7 +87,7 @@ public class BaseCommonLinkUtility } catch (Exception error) { - options.CreateLogger("ASC.Web").Error(error, error.Message); + options.CreateLogger("ASC.Web").ErrorWithException(error); } } diff --git a/common/ASC.Core.Common/Billing/CouponManager.cs b/common/ASC.Core.Common/Billing/CouponManager.cs index 559e5694bc..1583659a58 100644 --- a/common/ASC.Core.Common/Billing/CouponManager.cs +++ b/common/ASC.Core.Common/Billing/CouponManager.cs @@ -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; } diff --git a/common/ASC.Core.Common/Billing/License/LicenseReader.cs b/common/ASC.Core.Common/Billing/License/LicenseReader.cs index 4608295697..8d2200074c 100644 --- a/common/ASC.Core.Common/Billing/License/LicenseReader.cs +++ b/common/ASC.Core.Common/Billing/License/LicenseReader.cs @@ -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); } } } diff --git a/common/ASC.Core.Common/Billing/TariffService.cs b/common/ASC.Core.Common/Billing/TariffService.cs index bc403b2ed2..7ad46f085e 100644 --- a/common/ASC.Core.Common/Billing/TariffService.cs +++ b/common/ASC.Core.Common/Billing/TariffService.cs @@ -701,7 +701,7 @@ public class TariffService : ITariffService { if (Logger.IsEnabled(LogLevel.Debug)) { - Logger.ErrorBilling(tenantId, error); + Logger.ErrorBillingWithException(tenantId, error); } else { diff --git a/common/ASC.Core.Common/Core/DBResourceManager.cs b/common/ASC.Core.Common/Core/DBResourceManager.cs index addfaf4ad4..65ce0a7afa 100644 --- a/common/ASC.Core.Common/Core/DBResourceManager.cs +++ b/common/ASC.Core.Common/Core/DBResourceManager.cs @@ -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); } } diff --git a/common/ASC.Core.Common/Log/TariffServiceLogger.cs b/common/ASC.Core.Common/Log/TariffServiceLogger.cs index e5581e349e..3730e7fb00 100644 --- a/common/ASC.Core.Common/Log/TariffServiceLogger.cs +++ b/common/ASC.Core.Common/Log/TariffServiceLogger.cs @@ -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);