Directs tracing or debugging output to a TextWriter or to a Stream, formatted such that the message indents but all other attributes are always vertically aligned.
For a list of all members of this type, see AlignedTextWriterTraceListener Members.
System.Object
MarshalByRefObject
TraceListener
TextWriterTraceListener
AlignedTextWriterTraceListener
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
Like the DelimitedListTraceListener, XmlWriterTraceListener, and ConsoleTraceListener, this class derives from TextWriterTraceListener and can thus write to files or streams. The primary distinction of this TraceListener is that it always uses a single line of output per trace event; it guarantees all output options are always aligned vertically, with only the message inheriting the indentation level; and it makes indentation global across any instances of the class. This gives a more intuitive picture of the program structure when reviewing a lengthy log file. Furthermore, you have more control over output options: besides the ones selectable in TraceOptions, there are several others that are always emitted by other TraceListeners which you may turn off in this listener by setting their corresponding length properties to zero. These length properties serve to define a strict field width; if a value is larger, even if it is an integer, it is trimmed to fit your specified field width.
There are four methods to output tracing events: TraceEvent, TraceInformation, TraceData, and TraceTransfer. The AlignedTextWriterTraceListener overrides only TraceEvent and TraceInformation at this time.
Besides the description here, I have also published an article discussing the practical uses of this TraceListener -- Exploring Secrets of .NET Diagnostics -- available on the DevX online magazine.
Since CleanCode 0.9.20.
Namespace: CleanCode.Diagnostics
Assembly: CleanCode (in CleanCode.dll)
AlignedTextWriterTraceListener Members | CleanCode.Diagnostics Namespace