예제 #1
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;
 }
예제 #2
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();
 }
예제 #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>
 /// Send 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);
 }
예제 #5
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;
 }
예제 #6
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();
 }