1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-30 19:45:57 +00:00
Lidarr/NzbDrone.Web/Controllers/LogController.cs

56 lines
1.6 KiB
C#
Raw Normal View History

2012-01-23 02:24:16 +00:00
using System;
using System.Text;
using System.Web.Mvc;
using NzbDrone.Common;
using NzbDrone.Core.Instrumentation;
2011-08-22 01:00:12 +00:00
using NzbDrone.Web.Models;
using Telerik.Web.Mvc;
namespace NzbDrone.Web.Controllers
{
public class LogController : Controller
{
private readonly LogProvider _logProvider;
2012-01-23 02:24:16 +00:00
private readonly EnviromentProvider _enviromentProvider;
private readonly DiskProvider _diskProvider;
2012-01-23 02:24:16 +00:00
public LogController(LogProvider logProvider, EnviromentProvider enviromentProvider, DiskProvider diskProvider)
{
_logProvider = logProvider;
2012-01-23 02:24:16 +00:00
_enviromentProvider = enviromentProvider;
_diskProvider = diskProvider;
}
public ActionResult Index()
{
return View();
}
2012-01-23 02:24:16 +00:00
public FileContentResult File()
{
string log = string.Empty;
if (_diskProvider.FileExists(_enviromentProvider.GetArchivedLogFileName()))
{
log = _diskProvider.ReadAllText(_enviromentProvider.GetArchivedLogFileName());
}
log += _diskProvider.ReadAllText(_enviromentProvider.GetLogFileName());
return new FileContentResult(Encoding.ASCII.GetBytes(log), "text/plain");
}
public JsonResult Clear()
{
_logProvider.DeleteAll();
return JsonNotificationResult.Info("Logs Cleared");
}
[GridAction]
public ActionResult AjaxBinding()
{
return View(new GridModel(_logProvider.GetAllLogs()));
}
}
2011-04-10 02:44:01 +00:00
}