/// <summary> /// Initializes a new instance of the ApplicationDiagnostics class. /// </summary> public ApplicationDiagnostics(string logFilePath, string logFileFacility) { Trace.Listeners.Clear(); // Instantiate the BufferingTraceListener. bufferingTraceListener = new BufferingTraceListener(); // Connect the BufferingTraceListener to the Trace event streams. Trace.Listeners.Add(bufferingTraceListener); // Instantiate the LogFileTraceListener. logFileTraceListener = new LogFileTraceListener(logFilePath, logFileFacility); // Add our LogFileTraceListener to the Trace event stream. Trace.Listeners.Add(logFileTraceListener); // Don't include the default Trace listeners in release builds, so that we will not display // trace assertions in the default way. if (ApplicationDiagnostics.TestMode) { Trace.Listeners.Add(new DefaultTraceListener()); } }
/// <summary> /// Initializes a new instance of the DiagnosticsConsole class. /// </summary> /// <param name="bufferingTraceListener">The BufferingTraceListener where we get events from.</param> /// <param name="title">The title.</param> public DiagnosticsConsole(BufferingTraceListener bufferingTraceListener, string title) : this() { Text = String.Format(CultureInfo.InvariantCulture, "{0} - {1} Diagnostics Console", ApplicationEnvironment.ProductNameQualified, title); this.bufferingTraceListener = bufferingTraceListener; this.bufferingTraceListener.Changed += new EventHandler(bufferingTraceListener_Changed); }