This class represents a single audit log entry.
예제 #1
0
 private AuditLogger(AuditLogEntry logEntry)
 {
     Providers = new ServiceLocatableDictionary<AuditLogProviderBase>(null);
     this.logEntry = logEntry;
     ConfigManager.GetConfigurationSection<AuditTrailSettings>()
         .Configure(ServiceLocatorFactory.GetServiceLocator());
 }
 protected override void WriteCore(AuditLogEntry logEntry)
 {
     Guard.ArgumentNotNull(logEntry, "logEntry");
     foreach (var current in Listeners)
     {
         current.Write(logEntry);
     }
 }
예제 #3
0
 /// <summary>
 ///     Writes the specified audit log entry.
 /// </summary>
 /// <param name="logEntry">The audit log entry.</param>
 public void Write(AuditLogEntry logEntry)
 {
     Guard.ArgumentNotNull(logEntry, "logEntry");
     if (Filter.Match(logEntry))
     {
         WriteCore(logEntry);
     }
 }
예제 #4
0
 /// <summary>
 ///     Create <see cref="T:Cedar.Framework.AuditTrail.AuditLogger" /> based on the specified function name.
 /// </summary>
 /// <param name="functionName">Name of the function.</param>
 /// <returns>The creatd <see cref="T:Cedar.Framework.AuditTrail.AuditLogger" />.</returns>
 public static AuditLogger CreateAuditLogger(string functionName)
 {
     Guard.ArgumentNotNullOrEmpty(functionName, "functionName");
     if (string.IsNullOrEmpty(ApplicationContext.Current.UserName))
     {
         //throw new InvalidOperationException(Resources.ExceptionCurrentUserNameNotExists);
     }
     if (string.IsNullOrEmpty(ApplicationContext.Current.TransactionId))
     {
         //throw new InvalidOperationException(Resources.ExceptionCurrentTransactionIdNotExists);
     }
     var auditLogEntry = new AuditLogEntry(functionName, null, null, null, null);
     return new AuditLogger(auditLogEntry);
 }
예제 #5
0
 /// <summary>
 ///     Writes the specified audit log entry.
 /// </summary>
 /// <param name="logEntry">The audit log entry.</param>
 protected override void WriteCore(AuditLogEntry logEntry)
 {
     Guard.ArgumentNotNull(logEntry, "logEntry");
     RedisDatabaseWrapper.StringSet($"{logEntry.FunctionName}:{logEntry.TransactionId}",
         JsonConvert.SerializeObject(logEntry));
 }
예제 #6
0
 /// <summary>
 ///     Matches the specified log entry.
 /// </summary>
 /// <param name="logEntry">The log entry.</param>
 /// <returns>
 ///     A <see cref="T:System.Boolean" /> value indicating whether to match the specified log entry.
 /// </returns>
 public override bool Match(AuditLogEntry logEntry)
 {
     Guard.ArgumentNotNull(logEntry, "logEntry");
     return false;
 }
예제 #7
0
 /// <summary>
 ///     Matches the specified log entry.
 /// </summary>
 /// <param name="logEntry">The log entry.</param>
 /// <returns>
 ///     A <see cref="T:System.Boolean" /> value indicating whether to match the specified log entry.
 /// </returns>
 public abstract bool Match(AuditLogEntry logEntry);
예제 #8
0
 /// <summary>
 ///     Writes the specified audit log entry.
 /// </summary>
 /// <param name="logEntry">The audit log entry.</param>
 protected abstract void WriteCore(AuditLogEntry logEntry);