Mineplex2018-withcommit/Website/LOC.Website.Common/Logger.cs

32 lines
834 B
C#
Raw Normal View History

2013-08-27 17:14:08 +02:00
namespace LOC.Website.Common
{
using System;
using Contexts;
using Core;
using Data;
public class Logger : ILogger
{
private readonly INautilusRepositoryFactory _nautilusRepositoryFactory;
public Logger(INautilusRepositoryFactory nautilusRepositoryFactory)
{
_nautilusRepositoryFactory = nautilusRepositoryFactory;
}
public void Log(string category, string message)
{
using (var repository = _nautilusRepositoryFactory.CreateRepository())
{
repository.Add(new LogEntry
{
Date = DateTime.Now,
Category = category,
Message = message
});
repository.CommitChanges();;
}
}
}
}