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

A log handler that buffers records until a record with a certain level is encountered which causes the entire buffer to be flushed to another handler. More...

Public Member Functions

 BufferedHandler (int bufferSize, Handler outputHandler, LogLevel outputTriggerLevel)
 Creates a new instance. More...
 
void Dispose ()
 
void Log (LogRecord record)
 
void Log (LogRecord record)
 

Protected Member Functions

void FlushBuffer ()
 Passes all buffered records to the outputHandler and clears the buffer. More...
 

Properties

Handler OutputHandler [get]
 The handler that will write out the buffered records. More...
 
LogLevel OutputTriggerLevel [get]
 The log level that will cause the buffer to be flushed. More...
 
int BufferSize [get]
 The size of the record buffer. More...
 
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...
 
- 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 that buffers records until a record with a certain level is encountered which causes the entire buffer to be flushed to another handler.

Remarks
The handler can be used to log only certain levels and a number of other records leading to the record with the specified level. For example logging only errors but also the records leading up to the error.
Since
0.4.0

Constructor & Destructor Documentation

◆ BufferedHandler()

Joutsen.Logging.BufferedHandler.BufferedHandler ( int  bufferSize,
Handler  outputHandler,
LogLevel  outputTriggerLevel 
)

Creates a new instance.

Parameters
bufferSizethe number of records to buffer
outputHandlerthe handler to pass the buffered records to
outputTriggerLevelthe log level that triggers a flush of the buffer

Member Function Documentation

◆ Dispose()

void Joutsen.Logging.BufferedHandler.Dispose ( )

◆ FlushBuffer()

void Joutsen.Logging.BufferedHandler.FlushBuffer ( )
protected

Passes all buffered records to the outputHandler and clears the buffer.

◆ Log()

void Joutsen.Logging.BufferedHandler.Log ( LogRecord  record)

Property Documentation

◆ BufferSize

int Joutsen.Logging.BufferedHandler.BufferSize
get

The size of the record buffer.

◆ Encoding

Encoding Joutsen.Logging.BufferedHandler.Encoding
getset

The encoding of the output.

Implements Joutsen.Logging.Handler.

◆ Filter

Filter Joutsen.Logging.BufferedHandler.Filter
getset

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

Remarks
This second stage of filtering records can be used to only wite specific records with a handler. This allows to use different handlers to write different kind of entries. E.g. one handler only writes errors, another one only warnings and a third one all remaining entries.

Implements Joutsen.Logging.Handler.

◆ Formatter

Formatter Joutsen.Logging.BufferedHandler.Formatter
getset

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

Implements Joutsen.Logging.Handler.

◆ OutputHandler

Handler Joutsen.Logging.BufferedHandler.OutputHandler
get

The handler that will write out the buffered records.

◆ OutputTriggerLevel

LogLevel Joutsen.Logging.BufferedHandler.OutputTriggerLevel
get

The log level that will cause the buffer to be flushed.