2011-04-10 02:44:01 +00:00
|
|
|
|
using System.Linq;
|
2010-10-24 07:46:58 +00:00
|
|
|
|
using NLog;
|
|
|
|
|
using SubSonic.Repository;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Instrumentation
|
|
|
|
|
{
|
2011-04-10 00:14:51 +00:00
|
|
|
|
public class LogProvider
|
2010-10-24 07:46:58 +00:00
|
|
|
|
{
|
|
|
|
|
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
|
|
|
|
private readonly IRepository _repository;
|
|
|
|
|
|
|
|
|
|
public LogProvider(IRepository repository)
|
|
|
|
|
{
|
|
|
|
|
_repository = repository;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IQueryable<Log> GetAllLogs()
|
|
|
|
|
{
|
|
|
|
|
return _repository.All<Log>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void DeleteAll()
|
|
|
|
|
{
|
|
|
|
|
_repository.DeleteMany(GetAllLogs());
|
|
|
|
|
Logger.Info("Cleared Log History");
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-04-10 02:44:01 +00:00
|
|
|
|
}
|