This class represents a single audit log entry.
コード例 #1
0
ファイル: AuditLogger.cs プロジェクト: Chinaccn/surfboard
 private AuditLogger(AuditLogEntry logEntry)
 {
     Providers = new ServiceLocatableDictionary<AuditLogProviderBase>(null);
     this.logEntry = logEntry;
     ConfigManager.GetConfigurationSection<AuditTrailSettings>()
         .Configure(ServiceLocatorFactory.GetServiceLocator());
 }
コード例 #2
0
 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
ファイル: AuditLogger.cs プロジェクト: Chinaccn/surfboard
 /// <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);