2013-09-12 22:42:01 +00:00
|
|
|
|
using NzbDrone.Core.Datastore;
|
2013-06-19 01:01:08 +00:00
|
|
|
|
using NzbDrone.Core.Instrumentation.Commands;
|
2013-09-11 06:33:47 +00:00
|
|
|
|
using NzbDrone.Core.Messaging;
|
2013-02-23 19:38:25 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Instrumentation
|
|
|
|
|
{
|
|
|
|
|
public interface ILogService
|
|
|
|
|
{
|
2013-06-05 00:49:53 +00:00
|
|
|
|
PagingSpec<Log> Paged(PagingSpec<Log> pagingSpec);
|
2013-02-23 19:38:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-08 03:18:26 +00:00
|
|
|
|
public class LogService : ILogService, IExecute<TrimLogCommand>, IExecute<ClearLogCommand>
|
2013-02-23 19:38:25 +00:00
|
|
|
|
{
|
|
|
|
|
private readonly ILogRepository _logRepository;
|
|
|
|
|
|
2013-03-05 19:58:53 +00:00
|
|
|
|
public LogService(ILogRepository logRepository)
|
2013-02-23 19:38:25 +00:00
|
|
|
|
{
|
|
|
|
|
_logRepository = logRepository;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-19 01:01:08 +00:00
|
|
|
|
public PagingSpec<Log> Paged(PagingSpec<Log> pagingSpec)
|
2013-02-23 19:38:25 +00:00
|
|
|
|
{
|
2013-06-19 01:01:08 +00:00
|
|
|
|
return _logRepository.GetPaged(pagingSpec);
|
2013-02-23 19:38:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-19 01:01:08 +00:00
|
|
|
|
public void Execute(TrimLogCommand message)
|
2013-02-23 19:38:25 +00:00
|
|
|
|
{
|
|
|
|
|
_logRepository.Trim();
|
|
|
|
|
}
|
2013-08-08 03:18:26 +00:00
|
|
|
|
|
|
|
|
|
public void Execute(ClearLogCommand message)
|
|
|
|
|
{
|
2013-08-08 07:38:14 +00:00
|
|
|
|
_logRepository.Purge();
|
2013-08-08 03:18:26 +00:00
|
|
|
|
}
|
2013-02-23 19:38:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|