Table of Contents

Class FormattedTextWriterTraceListener

Namespace
Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners
Assembly
Microsoft.Practices.EnterpriseLibrary.Logging.dll

Extends TextWriterTraceListener to add formatting capabilities.

public class FormattedTextWriterTraceListener : TextWriterTraceListener, IDisposable
Inheritance
FormattedTextWriterTraceListener
Implements
Derived
Inherited Members

Constructors

FormattedTextWriterTraceListener()

Initializes a new instance of FormattedTextWriterTraceListener.

public FormattedTextWriterTraceListener()

FormattedTextWriterTraceListener(ILogFormatter)

Initializes a new instance of FormattedTextWriterTraceListener with a ILogFormatter.

public FormattedTextWriterTraceListener(ILogFormatter formatter)

Parameters

formatter ILogFormatter

The formatter to format the messages.

FormattedTextWriterTraceListener(Stream)

Initializes a new instance of FormattedTextWriterTraceListener with a Stream.

public FormattedTextWriterTraceListener(Stream stream)

Parameters

stream Stream

The stream to write to.

FormattedTextWriterTraceListener(Stream, ILogFormatter)

Initializes a new instance of FormattedTextWriterTraceListener with a ILogFormatter and a Stream.

public FormattedTextWriterTraceListener(Stream stream, ILogFormatter formatter)

Parameters

stream Stream

The stream to write to.

formatter ILogFormatter

The formatter to format the messages.

FormattedTextWriterTraceListener(Stream, string)

Initializes a new named instance of FormattedTextWriterTraceListener with a Stream.

public FormattedTextWriterTraceListener(Stream stream, string name)

Parameters

stream Stream

The stream to write to.

name string

The name.

FormattedTextWriterTraceListener(Stream, string, ILogFormatter)

Initializes a new named instance of FormattedTextWriterTraceListener with a ILogFormatter and a Stream.

public FormattedTextWriterTraceListener(Stream stream, string name, ILogFormatter formatter)

Parameters

stream Stream

The stream to write to.

name string

The name.

formatter ILogFormatter

The formatter to format the messages.

FormattedTextWriterTraceListener(TextWriter)

Initializes a new instance of FormattedTextWriterTraceListener with a TextWriter.

public FormattedTextWriterTraceListener(TextWriter writer)

Parameters

writer TextWriter

The writer to write to.

FormattedTextWriterTraceListener(TextWriter, ILogFormatter)

Initializes a new instance of FormattedTextWriterTraceListener with a ILogFormatter and a TextWriter.

public FormattedTextWriterTraceListener(TextWriter writer, ILogFormatter formatter)

Parameters

writer TextWriter

The writer to write to.

formatter ILogFormatter

The formatter to format the messages.

FormattedTextWriterTraceListener(TextWriter, string)

Initializes a new named instance of FormattedTextWriterTraceListener with a TextWriter.

public FormattedTextWriterTraceListener(TextWriter writer, string name)

Parameters

writer TextWriter

The writer to write to.

name string

The name.

FormattedTextWriterTraceListener(TextWriter, string, ILogFormatter)

Initializes a new named instance of FormattedTextWriterTraceListener with a ILogFormatter and a TextWriter.

public FormattedTextWriterTraceListener(TextWriter writer, string name, ILogFormatter formatter)

Parameters

writer TextWriter

The writer to write to.

name string

The name.

formatter ILogFormatter

The formatter to format the messages.

FormattedTextWriterTraceListener(string)

Initializes a new instance of FormattedTextWriterTraceListener with a file name.

public FormattedTextWriterTraceListener(string fileName)

Parameters

fileName string

The file name to write to.

FormattedTextWriterTraceListener(string, ILogFormatter)

Initializes a new instance of FormattedTextWriterTraceListener with a ILogFormatter and a file name.

public FormattedTextWriterTraceListener(string fileName, ILogFormatter formatter)

Parameters

fileName string

The file name to write to.

formatter ILogFormatter

The formatter to format the messages.

FormattedTextWriterTraceListener(string, string)

Initializes a new named instance of FormattedTextWriterTraceListener with a ILogFormatter and a file name.

public FormattedTextWriterTraceListener(string fileName, string name)

Parameters

fileName string

The file name to write to.

name string

The name.

FormattedTextWriterTraceListener(string, string, ILogFormatter)

Initializes a new named instance of FormattedTextWriterTraceListener with a ILogFormatter and a file name.

public FormattedTextWriterTraceListener(string fileName, string name, ILogFormatter formatter)

Parameters

fileName string

The file name to write to.

name string

The name.

formatter ILogFormatter

The formatter to format the messages.

Properties

Formatter

Gets the ILogFormatter used to format the trace messages.

public ILogFormatter Formatter { get; set; }

Property Value

ILogFormatter

Methods

GetSupportedAttributes()

Declares "formatter" as a supported attribute name.

protected override string[] GetSupportedAttributes()

Returns

string[]

TraceData(TraceEventCache, string, TraceEventType, int, object)

Intercepts the tracing request to format the object to trace.

public override void TraceData(TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data)

Parameters

eventCache TraceEventCache

The context information.

source string

The trace source.

eventType TraceEventType

The severity.

id int

The event id.

data object

The object to trace.

Remarks

Formatting is only performed if the object to trace is a LogEntry and the formatter is set.