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

A class that defines a Joutsen.Logging.IFormatter that formats log entries as CSV file records. More...

Public Member Functions

 CsvFormatter ()
 
string Format (LogRecord record)
 Creates a formated string representation of the @paramref record which can be written. More...
 
string GetHeader (global::System.Text.Encoding encoding)
 Creates the header of a CSV file containing the column headers. More...
 
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...
 

Detailed Description

A class that defines a Joutsen.Logging.IFormatter that formats log entries as CSV file records.

Since
0.2.0
Examples\n\ref FormatterExamples

Constructor & Destructor Documentation

◆ CsvFormatter()

Joutsen.Logging.CsvFormatter.CsvFormatter ( )

Member Function Documentation

◆ Format()

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

Creates a formated string representation of the @paramref record which can be written.

Parameters
recordthe record to create a formatted string from
Returns
a string representation of the log record

Implements Joutsen.Logging.Formatter.

◆ GetHeader()

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

Creates the header of a CSV file containing the column headers.

Parameters
encodinginformation about the encoding that will be used to write log entries. This value will not be used by this formatter.
Returns
a comma separated list of the property names of the log record
Remarks
The result already contains a line break at the end.

◆ GetSeparator()

string Joutsen.Logging.CsvFormatter.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.CsvFormatter.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.