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

A class that defines a Joutsen.Logging.IFormatter that formats log entries as simple text lines. More...

Public Member Functions

 SimpleFormatter ()
 Creates a new instance of Joutsen.Logging.SimpleFormatter using the default line output format. More...
 
 SimpleFormatter (String format)
 Creates a new instance of Joutsen.Logging.SimpleFormatter using the default line output format. More...
 
string Format (LogRecord record)
 Creates a text representation of the @paramref record. More...
 
string GetHeader (global::System.Text.Encoding encoding)
 
string GetSeparator ()
 Creates a separator that is to be written between records. More...
 
string GetTail ()
 Creates additional information that is written after the last record. More...
 
- Public Member Functions inherited from Joutsen.Logging.Formatter
String Format (LogRecord record)
 Creates a formated string representation of the @paramref record which can be written. More...
 
String GetHeader (Encoding encoding)
 Creates the header that is to be written before the first record is written. More...
 
String GetTail ()
 Creates additional information that is written after the last record. More...
 
String GetSeparator ()
 Creates a separator that is to be written between records. More...
 

Properties

string RecordFormat [get]
 The format of a line of the log file. More...
 

Detailed Description

A class that defines a Joutsen.Logging.IFormatter that formats log entries as simple text lines.

Since
0.2.0
Examples\n\ref FormatterExamples

Constructor & Destructor Documentation

◆ SimpleFormatter() [1/2]

Joutsen.Logging.SimpleFormatter.SimpleFormatter ( )

Creates a new instance of Joutsen.Logging.SimpleFormatter using the default line output format.

Remarks
The default output format contains TimeStamp, ThreadId, SourceClassName, SourceMethodName, Message, ErrorType and ErrorMessage.

◆ SimpleFormatter() [2/2]

Joutsen.Logging.SimpleFormatter.SimpleFormatter ( String  format)

Creates a new instance of Joutsen.Logging.SimpleFormatter using the default line output format.

Parameters
theformat of a line of the log file

Member Function Documentation

◆ Format()

string Joutsen.Logging.SimpleFormatter.Format ( LogRecord  record)

Creates a text representation of the @paramref record.

Parameters
recordthe record to create a formatted string from
Returns
a Sytem.String representation of the @paramref record
Remarks
The returned Sytem.String will be terminated by a new line symbol.

Implements Joutsen.Logging.Formatter.

◆ GetHeader()

string Joutsen.Logging.SimpleFormatter.GetHeader ( global::System.Text.Encoding  encoding)

◆ GetSeparator()

string Joutsen.Logging.SimpleFormatter.GetSeparator ( )

Creates a separator that is to be written between records.

Returns
a separator string that is to be written between records.
Remarks
The separator is written between records and not after the header or before the tail.
Since
0.3.0

Implements Joutsen.Logging.Formatter.

◆ GetTail()

string Joutsen.Logging.SimpleFormatter.GetTail ( )

Creates additional information that is written after the last record.

Returns
A string representation of the footer that is to be written.
Remarks
The footer is important for output formats like XML which would not be valid without closing the root tag.

Implements Joutsen.Logging.Formatter.

Property Documentation

◆ RecordFormat

string Joutsen.Logging.SimpleFormatter.RecordFormat
get

The format of a line of the log file.

See the example for a detailed description of the format.

Examples\n\ref FormatterExamples