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