Пример #1
0
 /// <summary>
 ///  Copy constructor.
 /// </summary>
 /// <param name="aMemoryLogger">The MemoryLogger to copy.</param>
 public MemoryLogger(MemoryLogger aMemoryLogger) : this(aMemoryLogger.Capacity)
 {
     LogEntries = (ArrayList)((ArrayList)aMemoryLogger.LogEntries).Clone();
 }
Пример #2
0
 /// <summary>
 /// SetForSending the LogEntry to the MemoryLogger, then start the retrying thread.
 /// </summary>
 /// <param name="aLogEntry">The LogEntry to log.</param>
 /// <returns>Always returns true.</returns>
 private bool HandleLogFailure(LogEntry aLogEntry)
 {
     MemoryLogger.DoLog(aLogEntry);
     StartThread();
     return(true);
 }
Пример #3
0
 /// <summary>
 /// Attempt to transfer the stored LogEntries to their proper destination.
 /// </summary>
 /// <returns>true if all LogEntries transfered, false otherwise.</returns>
 private bool Transfer()
 {
     lock (this) { return(MemoryLogger.TransferTo(Logger)); }
 }
Пример #4
0
 /// <summary>
 /// Create a new instance of InsistentLogger.
 /// </summary>
 /// <param name="aLogger">The actual Logger that should eventually receive LogEntries.</param>
 /// <param name="capacity">The maximum number of LogEntries that should be stored for retrying.</param>
 /// <param name="anIntervalSeconds">The number of seconds between each retry at logging.</param>
 public InsistentLogger(Logger aLogger, int capacity, int anIntervalSeconds) : this()
 {
     Logger          = aLogger;
     MemoryLogger    = new MemoryLogger(capacity);
     IntervalSeconds = anIntervalSeconds;
 }