Joutsen Logging v0.5.0+22-gec3d058
Public Member Functions | Protected Attributes | Properties | List of all members
Joutsen.Logging.StreamHandler Class Reference

A log handler implementation that writes log records to a stream. More...

Public Member Functions

 StreamHandler (Stream stream, Formatter formatter, Encoding encoding=null)
 Creates a new instance of Joutsen.Logging.StreamHandler. More...
 
virtual void Log (LogRecord record)
 Writes a log entry using the format provided by the Joutsen.Logging.StreamHandler.Formatter. More...
 
virtual void Dispose ()
 Writes the remaining values to the stream before it is closed. More...
 
void Log (LogRecord record)
 

Protected Attributes

TextWriter writer
 The see System.IO.TextWriter that is used to write to the stream. More...
 
bool firstRecordWritten
 Determines whether the first record has already been written. More...
 

Properties

Stream Stream [get, protected set]
 The stream to write to. More...
 
Filter Filter [get, set]
 An optional filter which determines if the record is handled by this handler. More...
 
Formatter Formatter [get, set]
 The formatter to be used to create the log entries which are written. More...
 
global::System.Text.Encoding Encoding [get, set]
 The encoding to use when writing to the stream. More...
 
bool AutoFlush [get, set]
 Determines if the records written are immediately flushed by the stream. More...
 
- Properties inherited from Joutsen.Logging.Handler
Filter Filter [get, set]
 An optional filter which determines if the record is handled by this handler. More...
 
Formatter Formatter [get, set]
 he formatter to be used to create the log entries which are written. More...
 
Encoding Encoding [get, set]
 The encoding of the output. More...
 

Detailed Description

A log handler implementation that writes log records to a stream.

Remarks
The most common way of using this class is to pass a System.IO.FileStream in order to write log records to a file.
Since
0.2.0

Constructor & Destructor Documentation

◆ StreamHandler()

Joutsen.Logging.StreamHandler.StreamHandler ( Stream  stream,
Formatter  formatter,
Encoding  encoding = null 
)

Creates a new instance of Joutsen.Logging.StreamHandler.

Parameters
streamthe stream to write to
formatterthe formatter to format the log entries before writing them to the stream
encodingthe encoding to use for writing

Member Function Documentation

◆ Dispose()

virtual void Joutsen.Logging.StreamHandler.Dispose ( )
virtual

Writes the remaining values to the stream before it is closed.

Reimplemented in Joutsen.Logging.ConsoleHandler.

◆ Log()

virtual void Joutsen.Logging.StreamHandler.Log ( LogRecord  record)
virtual

Writes a log entry using the format provided by the Joutsen.Logging.StreamHandler.Formatter.

Parameters
recordthe record to write

Implements Joutsen.Logging.Handler.

Reimplemented in Joutsen.Logging.ConsoleHandler.

Member Data Documentation

◆ firstRecordWritten

bool Joutsen.Logging.StreamHandler.firstRecordWritten
protected

Determines whether the first record has already been written.

◆ writer

TextWriter Joutsen.Logging.StreamHandler.writer
protected

The see System.IO.TextWriter that is used to write to the stream.

Property Documentation

◆ AutoFlush

bool Joutsen.Logging.StreamHandler.AutoFlush
getset

Determines if the records written are immediately flushed by the stream.

◆ Encoding

global.System.Text.Encoding Joutsen.Logging.StreamHandler.Encoding
getset

The encoding to use when writing to the stream.

Implements Joutsen.Logging.Handler.

◆ Filter

Filter Joutsen.Logging.StreamHandler.Filter
getset

An optional filter which determines if the record is handled by this handler.

Implements Joutsen.Logging.Handler.

◆ Formatter

Formatter Joutsen.Logging.StreamHandler.Formatter
getset

The formatter to be used to create the log entries which are written.

Implements Joutsen.Logging.Handler.

◆ Stream

Stream Joutsen.Logging.StreamHandler.Stream
getprotected set

The stream to write to.