using System.Threading.Tasks;
using Castle.Core.Logging;
namespace Abp.Auditing
{
///
/// Implements to simply write audits to logs.
///
public class SimpleLogAuditingStore : IAuditingStore
{
///
/// Singleton instance.
///
public static SimpleLogAuditingStore Instance { get; } = new SimpleLogAuditingStore();
public ILogger Logger { get; set; }
public SimpleLogAuditingStore()
{
Logger = NullLogger.Instance;
}
public Task SaveAsync(AuditInfo auditInfo)
{
if (auditInfo.Exception == null)
{
Logger.Info(auditInfo.ToString());
}
else
{
Logger.Warn(auditInfo.ToString());
}
return Task.FromResult(0);
}
}
}