You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/NzbDrone.Core/Instrumentation/DeleteLogFilesService.cs

40 lines
1.3 KiB

using NLog;
using NzbDrone.Common.Disk;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Instrumentation.Commands;
using NzbDrone.Core.Messaging.Commands;
namespace NzbDrone.Core.Instrumentation
{
public interface IDeleteLogFilesService
{
}
public class DeleteLogFilesService : IDeleteLogFilesService, IExecute<DeleteLogFilesCommand>, IExecute<DeleteUpdateLogFilesCommand>
{
private readonly IDiskProvider _diskProvider;
private readonly IAppFolderInfo _appFolderInfo;
private readonly Logger _logger;
public DeleteLogFilesService(IDiskProvider diskProvider, IAppFolderInfo appFolderInfo, Logger logger)
{
_diskProvider = diskProvider;
_appFolderInfo = appFolderInfo;
_logger = logger;
}
public void Execute(DeleteLogFilesCommand message)
{
_logger.Debug("Deleting all files in: {0}", _appFolderInfo.GetLogFolder());
_diskProvider.EmptyFolder(_appFolderInfo.GetLogFolder());
}
public void Execute(DeleteUpdateLogFilesCommand message)
{
_logger.Debug("Deleting all files in: {0}", _appFolderInfo.GetUpdateLogFolder());
_diskProvider.EmptyFolder(_appFolderInfo.GetUpdateLogFolder());
}
}
}