| 12345678910111213141516171819202122232425262728293031323334353637 |
- using System.Threading.Tasks;
- using Castle.Core.Logging;
- namespace Abp.Auditing
- {
- /// <summary>
- /// Implements <see cref="IAuditingStore"/> to simply write audits to logs.
- /// </summary>
- public class SimpleLogAuditingStore : IAuditingStore
- {
- /// <summary>
- /// Singleton instance.
- /// </summary>
- 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);
- }
- }
- }
|