Example #1
0
 /// <summary>
 /// Provides an automated wrapper for timing an operation and logging a message to a given PerformanceLog
 /// 
 /// This method should not be used for timing asynchronous operations.
 /// </summary>
 /// <param name="message">The message to log.</param>
 /// <param name="log">The <typeparamref name="PerformanceLog"/> the message should be written to.</param>
 /// <param name="code">The code to be invoked and timed.</param>
 /// <returns><typeparamref name="PerformanceLog"/> which is the same <typeparamref name="PerformanceLog"/> passed into the method.</returns>
 public PerformanceLog LogScope(String message, PerformanceLog log, PerformanceLogEntryType type, CodeBlock code)
 {
     lock (obj)
     {
         this.SetMarker();
         code.Invoke();
         this.ReleaseMarker();
         log.LogData(message, this.Duration, type);
     }
     return log;
 }
Example #2
0
 public void Add(PerformanceLog log)
 {
     Log.Add(log);
 }