Class FlatFileTraceListener
- 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
FileStreamThe file stream.
name
stringThe name.
formatter
ILogFormatterThe 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
StreamWriterThe stream writer.
name
stringThe name.
formatter
ILogFormatterThe 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
stringThe file stream.
header
stringThe header.
footer
stringThe footer.
formatter
ILogFormatterThe 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
TraceEventCacheThe context information provided by System.Diagnostics.
source
stringThe name of the trace source that delivered the trace data.
eventType
TraceEventTypeThe type of event.
id
intThe id of the event.
data
objectThe data to trace.