Create TraceSource and trace events : TraceSource : Development C# Examples


C# Examples » Development » TraceSource »

 

Create TraceSource and trace events









    
using  System;
using  System.Collections.Generic;
using  System.Diagnostics;
using  System.Text;


public  class  MainClass
{
        public  static  void  Main()
        {
                Trace.Listeners.Add(new  ConsoleTraceListener());
                TraceSource  customerTraceSource  =  new  TraceSource("YourClassName");
                Trace.WriteLine("Instantiated  a  new  customer  {0}",  "asdf");
                Debug.Assert(1  ==  2,  "1  ==2");
                customerTraceSource.TraceEvent(TraceEventType.Warning,  1000,"data  might  be  corrupt");
        }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» TraceSource