Table of Contents

Class FlatFileTraceListener

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

A TraceListener that writes to a flat file, formatting the output with an ILogFormatter.

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

Constructors

FlatFileTraceListener(FileStream, string, ILogFormatter)

Initializes a new named instance of FlatFileTraceListener with a FileStream and a ILogFormatter.

public FlatFileTraceListener(FileStream stream, string name = null, ILogFormatter formatter = null)

Parameters

stream FileStream

The file stream.

name string

The name.

formatter ILogFormatter

The formatter.

FlatFileTraceListener(StreamWriter, string, ILogFormatter)

Initializes a new named instance of FlatFileTraceListener with a StreamWriter and a ILogFormatter.

public FlatFileTraceListener(StreamWriter writer, string name = null, ILogFormatter formatter = null)

Parameters

writer StreamWriter

The stream writer.

name string

The name.

formatter ILogFormatter

The formatter.

FlatFileTraceListener(string, string, string, ILogFormatter)

Initializes a new instance of FlatFileTraceListener with a file name, a header, a footer and a ILogFormatter.

public FlatFileTraceListener(string fileName, string header = null, string footer = null, ILogFormatter formatter = null)

Parameters

fileName string

The file stream.

header string

The header.

footer string

The footer.

formatter ILogFormatter

The formatter.

Methods

GetSupportedAttributes()

Declare the supported attributes for FlatFileTraceListener

protected override string[] GetSupportedAttributes()

Returns

string[]

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

Delivers the trace data to the underlying file.

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

Parameters

eventCache TraceEventCache

The context information provided by System.Diagnostics.

source string

The name of the trace source that delivered the trace data.

eventType TraceEventType

The type of event.

id int

The id of the event.

data object

The data to trace.