Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
UdpTraceListener example usage
class Program
{
static void Main(string[] args)
{
Trace.Listeners.Add(new UdpTraceListener());
Thread thread1 = new Thread(() => {
Trace.WriteLine("I'm in a new thread 1");
Trace.WriteLine("I'm in a new thread 2");
Trace.WriteLine("I'm in a new thread 3");
});
Thread thread2 = new Thread(() =>
{
Trace.WriteLine("I'm in a new thread also 1");
Trace.WriteLine("I'm in a new thread also 2");
Trace.WriteLine("I'm in a new thread also 3");
});
thread1.Start();
Trace.WriteLine("Hello world");
Trace.WriteLine("Warning Will Robinson", "warning");
thread2.Start();
Trace.WriteLine("Catastrophic failure", "error");
Trace.WriteLine(42, "fatal");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.