TraceSource.Switch
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
public class MainClass
{
public static void Main()
{
TraceSource ts = new TraceSource("MyTraceSource");
ts.Listeners.Add(new ConsoleTraceListener());
ts.Switch = new SourceSwitch("mySource");
ts.Switch.Level = SourceLevels.Error;
ts.TraceEvent(TraceEventType.Information, 0, "Information event");
ts.TraceEvent(TraceEventType.Error, 0, "Error event");
}
}
Related examples in the same category