mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
TopLogs will now return the count pass in, reduced to 5000 from 7500 to prevent JsonSerialization issues when being sent to the grid.
Added tests for TopLogs and GetPagedLogs.
This commit is contained in:
parent
73fadac397
commit
070115a59a
3 changed files with 77 additions and 11 deletions
|
@ -22,15 +22,15 @@ namespace NzbDrone.Core.Instrumentation
|
|||
return _database.Fetch<Log>();
|
||||
}
|
||||
|
||||
public IList<Log> TopLogs()
|
||||
public IList<Log> TopLogs(int count)
|
||||
{
|
||||
var logs = _database.Fetch<Log>("SELECT TOP 7500 * FROM Logs ORDER BY Time Desc");
|
||||
var logs = _database.Fetch<Log>("SELECT TOP " + count + " * FROM Logs ORDER BY Time Desc");
|
||||
logs.Add(new Log
|
||||
{
|
||||
Time = DateTime.Now.AddYears(-100),
|
||||
Level = "Info",
|
||||
Logger = "NzbDrone.Core.Instrumentation.LogProvider",
|
||||
Message = String.Format("Number of logs currently shown: 7500. More may exist, check 'All' to see everything")
|
||||
Logger = "Core.Instrumentation.LogProvider",
|
||||
Message = String.Format("Number of logs currently shown: {0}. More may exist, check 'All' to see everything", Math.Min(count, logs.Count))
|
||||
});
|
||||
|
||||
return logs;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue