示例#1
0
 private async Task SafeTrackAsync(string message, Exception ex, IHealthWriter writer)
 {
     try
     {
         await writer.WriteTraceAsync(_traceEventType, message, ex).ConfigureAwait(false);
     }
     catch (Exception exception)
     {
         Trace.TraceError($"Error writing event to listener {writer.GetType().ToString()}. Exception:\r\n{exception.ToString()}");
     }
 }
示例#2
0
 public void AddWriter(IHealthWriter newWriter)
 {
     if (newWriter != null)
     {
         if (newWriter.AllowMultipleInstances() || !HealthWriters.Available.Where(w => w.GetType() == newWriter.GetType()).Any())
         {
             HealthWriters.Available.Add(newWriter);
         }
     }
 }