Name
TraceListener
Synopsis
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 method TraceListener(); protected method TraceListener(string name); // Public Instance Properties public field int IndentLevel{set; get; } public field int IndentSize{set; get; } public virtual field string Name{set; get; } // Protected Instance Properties protected field bool NeedIndent{set; get; } // Public Instance Methods ...
Get C# in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.