add loggers

This commit is contained in:
Anton Suhorukov 2022-05-13 17:48:49 +03:00
parent 92c6844810
commit 5131e6df09
23 changed files with 520 additions and 57 deletions

View File

@ -47,6 +47,7 @@ global using System.Xml;
global using ASC.Common;
global using ASC.Common.Caching;
global using ASC.Common.Log;
global using ASC.Common.Logging;
global using ASC.Common.Notify.Engine;
global using ASC.Common.Security;
@ -88,6 +89,7 @@ global using ASC.Security.Cryptography;
global using ASC.VoipService.Dao;
global using ASC.Web.Core;
global using ASC.Web.Core.Helpers;
global using ASC.Web.Core.Log;
global using ASC.Web.Core.ModuleManagement.Common;
global using ASC.Web.Core.Notify;
global using ASC.Web.Core.PublicResources;

View File

@ -0,0 +1,35 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Web.Core.Log;
internal static partial class LogoUploaderLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "SaveTmpLogo")]
public static partial void ErrorSaveTmpLogo(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "DeleteLogo")]
public static partial void ErrorDeleteLogo(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,38 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Web.Core.Log;
internal static partial class NotifyConfigurationLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "ProductSecurityInterceptor")]
public static partial void ErrorProductSecurityInterceptor(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "AddLetterLogo")]
public static partial void ErrorAddLetterLogo(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "NotifyClientRegisterCallback")]
public static partial void ErrorNotifyClientRegisterCallback(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,50 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Web.Core.Log;
internal static partial class SmsProviderLogger
{
[LoggerMessage(Level = LogLevel.Information, Message = "SMS was sent to {number}, service returned: {result}")]
public static partial void InformationSMSWasSend(this ILogger logger, string number, string result);
[LoggerMessage(Level = LogLevel.Error, Message = "Failed to send sms message")]
public static partial void ErrorSendSms(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Failed request sms balance")]
public static partial void ErrorRequestSms(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Failed to send sms message via tiwilio")]
public static partial void ErrorSendSmsViaTiwilio(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "Failed to send sms. code: {code} {message}")]
public static partial void ErrorSendSmsWithCode(this ILogger logger, int code, string message);
[LoggerMessage(Level = LogLevel.Information, Message = "SMS balance service returned: {result}")]
public static partial void InformationSmsBalaceReturned(this ILogger logger, string result);
[LoggerMessage(Level = LogLevel.Information, Message = "SMS was sent to {number}, status: {status}")]
public static partial void InformationSmsWasSendTo(this ILogger logger, string number, MessageResource.StatusEnum status);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Web.Core.Log;
internal static partial class SmsSenderLogger
{
[LoggerMessage(Level = LogLevel.Information, Message = "Tenant {tenantId} send sms to phoneNumber {number} {message}")]
public static partial void InformationSendSmsToPhoneNumber(this ILogger logger, int tenantId, string number, string message);
}

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Web.Core.Log;
internal static partial class StudioNotifyHelperLogger
{
[LoggerMessage(Level = LogLevel.Warning, Message = "Free tenant {tenantId} for today is trying to send {tryCount} more letters without checking activation. Sent {mayTake}")]
public static partial void WarningFreeTenant(this ILogger logger, int tenantId, int tryCount, int mayTake);
}

View File

@ -0,0 +1,41 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Web.Core.Log;
internal static partial class StudioNotifyServiceLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "SendMsgProfileHasDeletedItself")]
public static partial void ErrorSendMsgProfileHasDeletedItself(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "SendCongratulations")]
public static partial void ErrorSendCongratulations(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "PortalRenameNotify")]
public static partial void ErrorPortalRenameNotify(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "SendRegData")]
public static partial void ErrorSendRegData(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,83 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Web.Core.Log;
internal static partial class StudioPeriodicNotifyLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "SendSaasLettersAsync")]
public static partial void ErrorSendSaasLettersAsync(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "SendEnterpriseLetters")]
public static partial void ErrorSendEnterpriseLetters(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "SendOpensourceLetters")]
public static partial void ErrorSendOpensourceLetters(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "SendPersonalLetters")]
public static partial void ErrorSendPersonalLetters(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "SendMsgWhatsNew")]
public static partial void ErrorSendMsgWhatsNew(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Information, Message = "Start SendSaasTariffLetters")]
public static partial void InformationStartSendSaasTariffLetters(this ILogger logger);
[LoggerMessage(Level = LogLevel.Information, Message = "End SendSaasTariffLetters")]
public static partial void InformationEndSendSaasTariffLetters(this ILogger logger);
[LoggerMessage(Level = LogLevel.Information, Message = "start CreateCoupon to {alias}")]
public static partial void InformationStartCreateCoupon(this ILogger logger, string alias);
[LoggerMessage(Level = LogLevel.Information, Message = "end CreateCoupon to {alias} coupon = {coupon}")]
public static partial void InformationEndCreateCoupon(this ILogger logger, string alias, string coupon);
[LoggerMessage(Level = LogLevel.Information, Message = "Start SendTariffEnterpriseLetters")]
public static partial void InformationStartSendTariffEnterpriseLetters(this ILogger logger);
[LoggerMessage(Level = LogLevel.Information, Message = "End SendTariffEnterpriseLetters")]
public static partial void InformationEndSendTariffEnterpriseLetters(this ILogger logger);
[LoggerMessage(Level = LogLevel.Information, Message = "Start SendOpensourceTariffLetters")]
public static partial void InformationStartSendOpensourceTariffLetters(this ILogger logger);
[LoggerMessage(Level = LogLevel.Information, Message = "End SendOpensourceTariffLetters")]
public static partial void InformationEndSendOpensourceTariffLetters(this ILogger logger);
[LoggerMessage(Level = LogLevel.Information, Message = "Start SendLettersPersonal...")]
public static partial void InformationStartSendLettersPersonal(this ILogger logger);
[LoggerMessage(Level = LogLevel.Information, Message = "Current tenant: {tenantId}")]
public static partial void InformationCurrentTenant(this ILogger logger, int tenantId);
[LoggerMessage(Level = LogLevel.Information, Message = "Send letter personal '{id}' to {email} culture {culture}. tenant id: {tenantId} user culture {userCulture} create on {createDate} now date {scheduleDate}")]
public static partial void InformationSendLetterPersonal(this ILogger logger, string id, string email, CultureInfo culture, int tenantId, CultureInfo userCulture, DateTime createDate, DateTime scheduleDate);
[LoggerMessage(Level = LogLevel.Information, Message = "Total send count: {sendCount}")]
public static partial void InformationTotalSendCount(this ILogger logger, int sendCount);
[LoggerMessage(Level = LogLevel.Information, Message = "End SendLettersPersonal.")]
public static partial void InformationEndSendLettersPersonal(this ILogger logger);
}

View File

@ -0,0 +1,41 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Web.Core.Log;
internal static partial class StudioWhatsNewNotifyLogger
{
[LoggerMessage(Level = LogLevel.Information, Message = "No products. Return from function")]
public static partial void InformationNoProducts(this ILogger logger);
[LoggerMessage(Level = LogLevel.Information, Message = "Start send whats new.")]
public static partial void InformationStartSendWhatsNew(this ILogger logger);
[LoggerMessage(Level = LogLevel.Information, Message = "Start send whats new in {domain} ({tenantId}).")]
public static partial void InformationStartSendWhatsNewIn(this ILogger logger, string domain, int tenantId);
[LoggerMessage(Level = LogLevel.Information, Message = "Send whats new to {email}")]
public static partial void InformationSendWhatsNewTo(this ILogger logger, string email);
}

View File

@ -0,0 +1,35 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Web.Core.Log;
internal static partial class TenantWhiteLabelSettingsHelperLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "TenantWhiteLabelSettingsHelper RestoreDefault")]
public static partial void ErrorRestoreDefault(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "TenantWhiteLabelSettingsHelper SetLogo")]
public static partial void ErrorSetLogo(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,38 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Web.Core.Log;
internal static partial class UserPhotoManagerLogger
{
[LoggerMessage(Level = LogLevel.Error, Message = "LoadDiskCache")]
public static partial void ErrorLoadDiskCache(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "RemovePhoto")]
public static partial void ErrorRemovePhoto(this ILogger logger, Exception exception);
[LoggerMessage(Level = LogLevel.Error, Message = "GetUserPhotoData")]
public static partial void ErrorGetUserPhotoData(this ILogger logger, Exception exception);
}

View File

@ -0,0 +1,35 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Web.Core.Log;
internal static partial class WebItemManagerLogger
{
[LoggerMessage(Level = LogLevel.Debug, Message = "Web item {webitem} loaded")]
public static partial void DebugWebItemLoaded(this ILogger logger, string webitem);
[LoggerMessage(Level = LogLevel.Error, Message = "Couldn't load web item {file}")]
public static partial void ErrorCouldntLoadWebItem(this ILogger logger, string file, Exception exception);
}

View File

@ -141,7 +141,7 @@ public class StorageHelper
}
catch (Exception ex)
{
_logger.LogError(ex, "SaveTmpLogo");
_logger.ErrorSaveTmpLogo(ex);
return null;
}
}
@ -166,7 +166,7 @@ public class StorageHelper
}
catch (Exception e)
{
_logger.LogError(e, "DeleteLogo");
_logger.ErrorDeleteLogo(e);
}
}

View File

@ -138,7 +138,7 @@ public class NotifyConfiguration
}
catch (Exception error)
{
scope.ServiceProvider.GetService<ILogger<NotifyConfiguration>>().LogError(error, "NotifyClientRegisterCallback");
scope.ServiceProvider.GetService<ILogger<NotifyConfiguration>>().ErrorNotifyClientRegisterCallback(error);
}
return false;
});
@ -243,7 +243,7 @@ public class ProductSecurityInterceptor
}
catch (Exception error)
{
_log.LogError(error, "ProductSecurityInterceptor");
_log.ErrorProductSecurityInterceptor(error);
}
return false;
@ -400,7 +400,7 @@ public class NotifyTransferRequest : INotifyEngineAction
}
catch (Exception error)
{
_log.LogError(error, "AddLetterLogo");
_log.ErrorAddLetterLogo(error);
}
}

View File

@ -162,7 +162,7 @@ public class StudioNotifyHelper
{
res = res.Take(mayTake).ToList();
_logger.LogWarning("Free tenant {tenantId} for today is trying to send {tryCount} more letters without checking activation. Sent {mayTake}", tenant.Id, tryCount, mayTake);
_logger.WarningFreeTenant(tenant.Id, tryCount, mayTake);
}
spamEmailSettings.MailsSended = sended + tryCount;
_settingsManager.Save(spamEmailSettings);

View File

@ -539,7 +539,7 @@ public class StudioNotifyService
}
catch (Exception ex)
{
_log.LogError(ex, "SendMsgProfileHasDeletedItself");
_log.ErrorSendMsgProfileHasDeletedItself(ex);
}
});
@ -761,7 +761,7 @@ public class StudioNotifyService
}
catch (Exception error)
{
_log.LogError(error, "SendCongratulations");
_log.ErrorSendCongratulations(error);
}
}
@ -858,7 +858,7 @@ public class StudioNotifyService
}
catch (Exception ex)
{
_log.LogError(ex, "PortalRenameNotify");
_log.ErrorPortalRenameNotify(ex);
}
}
@ -924,7 +924,7 @@ public class StudioNotifyService
}
catch (Exception error)
{
_log.LogError(error, "SendRegData");
_log.ErrorSendRegData(error);
}
}

View File

@ -24,6 +24,8 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using ASC.Common.Log;
namespace ASC.Web.Studio.Core.Notify;
[Scope]
@ -96,13 +98,13 @@ public class StudioPeriodicNotify
public Task SendSaasLettersAsync(string senderName, DateTime scheduleDate)
{
_log.LogInformation("Start SendSaasTariffLetters");
_log.InformationStartSendSaasTariffLetters();
var activeTenants = _tenantManager.GetTenants().ToList();
if (activeTenants.Count <= 0)
{
_log.LogInformation("End SendSaasTariffLetters");
_log.InformationEndSendSaasTariffLetters();
return Task.CompletedTask;
}
@ -323,24 +325,24 @@ public class StudioPeriodicNotify
{
try
{
_log.LogInformation("start CreateCoupon to {alias}", tenant.Alias);
_log.InformationStartCreateCoupon(tenant.Alias);
coupon = SetupInfo.IsSecretEmail(_userManager.GetUsers(tenant.OwnerId).Email)
? tenant.Alias
: _couponManager.CreateCoupon(_tenantManager);
_log.LogInformation("end CreateCoupon to {alias} coupon = {coupon}", tenant.Alias, coupon);
_log.InformationEndCreateCoupon(tenant.Alias, coupon);
}
catch (AggregateException ae)
{
foreach (var ex in ae.InnerExceptions)
{
_log.LogError(ex, "");
_log.ErrorWithException(ex);
}
}
catch (Exception ex)
{
_log.LogError(ex, "SendSaasLettersAsync");
_log.ErrorSendSaasLettersAsync(ex);
}
}
@ -486,11 +488,11 @@ public class StudioPeriodicNotify
}
catch (Exception err)
{
_log.LogError(err, "SendSaasLettersAsync");
_log.ErrorSendSaasLettersAsync(err);
}
}
_log.LogInformation("End SendSaasTariffLetters");
_log.InformationEndSendSaasTariffLetters();
}
public void SendEnterpriseLetters(string senderName, DateTime scheduleDate)
@ -498,13 +500,13 @@ public class StudioPeriodicNotify
var nowDate = scheduleDate.Date;
const string dbid = "webstudio";
_log.LogInformation("Start SendTariffEnterpriseLetters");
_log.InformationStartSendTariffEnterpriseLetters();
var activeTenants = _tenantManager.GetTenants().ToList();
if (activeTenants.Count <= 0)
{
_log.LogInformation("End SendTariffEnterpriseLetters");
_log.InformationEndSendTariffEnterpriseLetters();
return;
}
@ -879,24 +881,24 @@ public class StudioPeriodicNotify
}
catch (Exception err)
{
_log.LogError(err, "SendEnterpriseLetters");
_log.ErrorSendEnterpriseLetters(err);
}
}
_log.LogInformation("End SendTariffEnterpriseLetters");
_log.InformationEndSendTariffEnterpriseLetters();
}
public void SendOpensourceLetters(string senderName, DateTime scheduleDate)
{
var nowDate = scheduleDate.Date;
_log.LogInformation("Start SendOpensourceTariffLetters");
_log.InformationStartSendOpensourceTariffLetters();
var activeTenants = _tenantManager.GetTenants().ToList();
if (activeTenants.Count <= 0)
{
_log.LogInformation("End SendOpensourceTariffLetters");
_log.InformationEndSendOpensourceTariffLetters();
return;
}
@ -939,16 +941,16 @@ public class StudioPeriodicNotify
}
catch (Exception err)
{
_log.LogError(err, "SendOpensourceLetters");
_log.ErrorSendOpensourceLetters(err);
}
}
_log.LogInformation("End SendOpensourceTariffLetters");
_log.InformationEndSendOpensourceTariffLetters();
}
public void SendPersonalLetters(string senderName, DateTime scheduleDate)
{
_log.LogInformation("Start SendLettersPersonal...");
_log.InformationStartSendLettersPersonal();
var activeTenants = _tenantManager.GetTenants().ToList();
@ -964,7 +966,7 @@ public class StudioPeriodicNotify
_tenantManager.SetCurrentTenant(tenant.Id);
var client = _workContext.NotifyContext.RegisterClient(_notifyEngineQueue, _studioNotifyHelper.NotifySource);
_log.LogInformation("Current tenant: {tenantId}", tenant.Id);
_log.InformationCurrentTenant(tenant.Id);
var users = _userManager.GetUsers(EmployeeStatus.Active);
@ -984,7 +986,7 @@ public class StudioPeriodicNotify
catch (CultureNotFoundException exception)
{
_log.LogError(exception, "SendPersonalLetters");
_log.ErrorSendPersonalLetters(exception);
}
}
@ -1033,8 +1035,7 @@ public class StudioPeriodicNotify
continue;
}
_log.LogInformation(@"Send letter personal '{id}' to {email} culture {culture}. tenant id: {tenantId} user culture {culture} create on {createDate} now date {scheduleDate}",
action.ID, user.Email, culture, tenant.Id, user.GetCulture(), user.CreateDate, scheduleDate.Date);
_log.InformationSendLetterPersonal(action.ID, user.Email, culture, tenant.Id, user.GetCulture(), user.CreateDate, scheduleDate.Date);
sendCount++;
@ -1049,15 +1050,15 @@ public class StudioPeriodicNotify
new TagValue(CommonTags.Footer, _coreBaseSettings.CustomMode ? "personalCustomMode" : "personal"));
}
_log.LogInformation("Total send count: {sendCount}", sendCount);
_log.InformationTotalSendCount(sendCount);
}
catch (Exception err)
{
_log.LogError(err, "SendPersonalLetters");
_log.ErrorSendPersonalLetters(err);
}
}
_log.LogInformation("End SendLettersPersonal.");
_log.InformationEndSendLettersPersonal();
}
public static bool ChangeSubscription(Guid userId, StudioNotifyHelper studioNotifyHelper)

View File

@ -89,11 +89,11 @@ public class StudioWhatsNewNotify
{
if (_webItemManager.GetItemsAll<IProduct>().Count == 0)
{
_log.LogInformation("No products. Return from function");
_log.InformationNoProducts();
return;
}
_log.LogInformation("Start send whats new.");
_log.InformationStartSendWhatsNew();
var products = _webItemManager.GetItemsAll().ToDictionary(p => p.GetSysName());
var tenants = GetChangedTenants(scheduleDate);
@ -125,7 +125,7 @@ public class StudioWhatsNewNotify
_tenantManager.SetCurrentTenant(tenant);
var client = _workContext.NotifyContext.RegisterClient(_notifyEngineQueue, _studioNotifyHelper.NotifySource);
_log.LogInformation("Start send whats new in {domain} ({tenantId}).", tenant.GetTenantDomain(_coreSettings), tenantid);
_log.InformationStartSendWhatsNewIn(tenant.GetTenantDomain(_coreSettings), tenantid);
foreach (var user in _userManager.GetUsers())
{
if (!_studioNotifyHelper.IsSubscribedToNotify(user, Actions.SendWhatsNew))
@ -226,7 +226,7 @@ public class StudioWhatsNewNotify
if (activities.Count > 0)
{
_log.LogInformation("Send whats new to {email}", user.Email);
_log.InformationSendWhatsNewTo(user.Email);
client.SendNoticeAsync(
Actions.SendWhatsNew, null, user,
new TagValue(Tags.Activities, activities),
@ -238,7 +238,7 @@ public class StudioWhatsNewNotify
}
catch (Exception error)
{
_log.LogError(error, "SendMsgWhatsNew");
_log.ErrorSendMsgWhatsNew(error);
}
}

View File

@ -162,13 +162,13 @@ public abstract class SmsProvider : Consumer
{
using var reader = new StreamReader(stream);
var result = await reader.ReadToEndAsync();
Log.LogInformation("SMS was sent to {number}, service returned: {result}", number, result);
Log.InformationSMSWasSend(number, result);
return true;
}
}
catch (Exception ex)
{
Log.LogError(ex, "Failed to send sms message");
Log.ErrorSendSms(ex);
}
return false;
}
@ -260,14 +260,14 @@ public class SmscProvider : SmsProvider, IValidateKeysProvider
{
using var reader = new StreamReader(stream);
var result = await reader.ReadToEndAsync();
Log.LogInformation("SMS balance service returned: {result}", result);
Log.InformationSmsBalaceReturned(result);
balance = result;
}
}
catch (Exception ex)
{
Log.LogError(ex, "Failed request sms balance");
Log.ErrorRequestSms(ex);
balance = string.Empty;
}
@ -404,16 +404,16 @@ public class TwilioProvider : SmsProvider, IValidateKeysProvider
try
{
var smsMessage = MessageResource.Create(new PhoneNumber(number), body: message, @from: new PhoneNumber(Sender), client: twilioRestClient);
Log.LogInformation("SMS was sent to {number}, status: {status}", number, smsMessage.Status);
Log.InformationSmsWasSendTo(number, smsMessage.Status);
if (!smsMessage.ErrorCode.HasValue)
{
return Task.FromResult(true);
}
Log.LogError("Failed to send sms. code: {code} {message}", smsMessage.ErrorCode.Value, smsMessage.ErrorMessage);
Log.ErrorSendSmsWithCode(smsMessage.ErrorCode.Value, smsMessage.ErrorMessage);
}
catch (Exception ex)
{
Log.LogError(ex, "Failed to send sms message via tiwilio");
Log.ErrorSendSmsViaTiwilio(ex);
}
return Task.FromResult(false);

View File

@ -61,7 +61,7 @@ public class SmsSender
var tenant = _tenantManager.GetCurrentTenant(false);
var tenantId = tenant == null ? Tenant.DefaultTenant : tenant.Id;
_log.LogInformation("Tenant {tenantId} send sms to phoneNumber {number} {message}", tenantId, number, message);
_log.InformationSendSmsToPhoneNumber(tenantId, number, message);
return Task.FromResult(false);
}

View File

@ -514,7 +514,7 @@ public class UserPhotoManager
}
catch (Exception err)
{
_log.LogError(err, "LoadDiskCache");
_log.ErrorLoadDiskCache(err);
}
}
}
@ -540,7 +540,7 @@ public class UserPhotoManager
}
catch (DirectoryNotFoundException e)
{
_log.LogError(e, "RemovePhoto");
_log.ErrorRemovePhoto(e);
}
_userManager.SaveUserPhoto(idUser, null);
@ -904,7 +904,7 @@ public class UserPhotoManager
}
catch (Exception err)
{
_log.LogError(err, "GetUserPhotoData");
_log.ErrorGetUserPhotoData(err);
return null;
}
}

View File

@ -145,7 +145,7 @@ public class WebItemManager
}
catch (Exception exc)
{
_log.LogError(exc, $"Couldn't load web item {file}");
_log.ErrorCouldntLoadWebItem(file, exc);
}
}
@ -175,7 +175,7 @@ public class WebItemManager
}
result.TryAdd(webitem.ID, webitem);
_log.LogDebug("Web item {webitem} loaded", webitem.Name);
_log.DebugWebItemLoaded(webitem.Name);
}
}

View File

@ -269,7 +269,7 @@ public class TenantWhiteLabelSettingsHelper
}
catch (Exception e)
{
_log.LogError(e, "TenantWhiteLabelSettingsHelper RestoreDefault");
_log.ErrorRestoreDefault(e);
}
Save(tenantWhiteLabelSettings, tenantId, tenantLogoManager, true);
@ -287,7 +287,7 @@ public class TenantWhiteLabelSettingsHelper
}
catch (Exception e)
{
_log.LogError(e, "TenantWhiteLabelSettingsHelper RestoreDefault");
_log.ErrorRestoreDefault(e);
}
}
}
@ -312,7 +312,7 @@ public class TenantWhiteLabelSettingsHelper
}
catch (Exception e)
{
_log.LogError(e, "TenantWhiteLabelSettingsHelper SetLogo");
_log.ErrorSetLogo(e);
}
}
#endregion
@ -358,7 +358,7 @@ public class TenantWhiteLabelSettingsHelper
}
catch (Exception ex)
{
_log.LogError(ex, "TenantWhiteLabelSettingsHelper SetLogo");
_log.ErrorSetLogo(ex);
}
}
else