TraceListener

TraceListener CF 1.0, marshal by reference, disposable

System.Diagnostics (system.dll) abstract class

This abstract class TraceListener is associated with a trace through inclusion in the Trace.Listeners collection. Each TraceListener is responsible for sending trace output somewhere. For example, when you call Trace.WriteLine( ) , each TraceListener sends the same output to its respective output destination. Use Name to give a name to your TraceListener instances.

Use IndentLevel to control the level of indentation in the output. IndentSize specifies the number of spaces in each level of indent. NeedIndent toggles whether to indent the output at all. Use Write( ) and WriteLine( ) to send output to the TraceListener 's destination. WriteIndent( ) emits whitespace according to the current IndentLevel and IndentSize . It has the side effect of setting NeedIndent to false, so the next time you call one of the Write* methods , it will not emit extra indentation.

You can use the application configuration file to add or remove TraceListeners . Look up System.Diagnostics.TraceListener in the .NET Framework SDK Documentation for details.

 public abstract class  TraceListener  : MarshalByRefObject, IDisposable {  // Protected Constructors  protected  TraceListener  ( );    protected  TraceListener  (string   name   );  // Public Instance Properties  public int  IndentLevel  {set; get; }    public int  IndentSize  {set; get; }    public virtual string  Name  {set; get; }  // Protected Instance Properties  protected bool  NeedIndent  {set; get; }  // Public Instance Methods  public virtual void  Close  ( );    public void  Dispose  ( );  // implements IDisposable  public virtual void  Fail  (string   message   );    public virtual void  Fail  (string   message   , string   detailMessage   );    public virtual void  Flush  ( );    public virtual void  Write  (object   o   );    public virtual void  Write  (object   o   , string   category   );    public abstract void  Write  (string   message   );    public virtual void  Write  (string   message   , string   category   );    public virtual void  WriteLine  (object   o   );    public virtual void  WriteLine  (object   o   , string   category   );    public abstract void  WriteLine  (string   message   );    public virtual void  WriteLine  (string   message   , string   category   );  // Protected Instance Methods  protected virtual void  Dispose  (bool   disposing   );    protected virtual void  WriteIndent  ( ); } 

Hierarchy

System.Object System.MarshalByRefObject TraceListener(System.IDisposable)

Subclasses

DefaultTraceListener , EventLogTraceListener , TextWriterTraceListener

Returned By

TraceListenerCollection.this

Passed To

TraceListenerCollection.{Add( ) , AddRange( ) , Contains( ) , CopyTo( ) , IndexOf( ) , Insert( ) , Remove( ) , this}



C# in a Nutshell
C # in a Nutshell, Second Edition
ISBN: 0596005261
EAN: 2147483647
Year: 2005
Pages: 963

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net