structured logging
This commit is contained in:
28
Oqtane.Server/Repository/LogRepository.cs
Normal file
28
Oqtane.Server/Repository/LogRepository.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
public class LogRepository : ILogRepository
|
||||
{
|
||||
private TenantDBContext db;
|
||||
|
||||
public LogRepository(TenantDBContext context)
|
||||
{
|
||||
db = context;
|
||||
}
|
||||
|
||||
public void AddLog(Log Log)
|
||||
{
|
||||
db.Log.Add(Log);
|
||||
db.SaveChanges();
|
||||
}
|
||||
|
||||
public IEnumerable<Log> GetLogs(int SiteId)
|
||||
{
|
||||
return db.Log.Where(item => item.SiteId == SiteId).OrderByDescending(item=> item.LogDate).Take(50);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user