Try your search with a different keyword or use * as a wildcard.
using Nop.Core.Domain.Common;
using Nop.Services.ScheduleTasks;
namespace Nop.Services.Logging;
///
/// Represents a task to clear [Log] table
///
public partial class ClearLogTask : IScheduleTask
{
#region Fields
protected readonly CommonSettings _commonSettings;
protected readonly ILogger _logger;
#endregion
#region Ctor
public ClearLogTask(CommonSettings commonSettings,
ILogger logger)
{
_commonSettings = commonSettings;
_logger = logger;
}
#endregion
#region Methods
///
/// Executes a task
///
public virtual async System.Threading.Tasks.Task ExecuteAsync()
{
var utcNow = DateTime.UtcNow;
await _logger.ClearLogAsync(_commonSettings.ClearLogOlderThanDays == 0 ? null : utcNow.AddDays(-_commonSettings.ClearLogOlderThanDays));
}
#endregion
}