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()}"); } }
public void AddWriter(IHealthWriter newWriter) { if (newWriter != null) { if (newWriter.AllowMultipleInstances() || !HealthWriters.Available.Where(w => w.GetType() == newWriter.GetType()).Any()) { HealthWriters.Available.Add(newWriter); } } }