@livy/csv-formatter
v1.0.4
Published
Formats Livy log records as CSV lines
Downloads
6
Maintainers
Readme
@livy/csv-formatter
This Livy formatter formats log records as CSV lines.
Basic Example
const { FileHandler } = require('@livy/file-handler')
const { CsvFormatter } = require('@livy/csv-formatter')
const handler = new FileHandler('logs.csv', {
formatter: new CsvFormatter()
})
Installation
Install it via npm:
npm install @livy/csv-formatter
Options
An object of options can be passed to this formatter's constructor.
The following options are available:
delimiter
Type: string
Default: ','
Description: The delimiter to separate columns.
enclosure
Type: string
Default: '"'
Description: The string to enclose fields.
eol
Type: string
Default: '\r\n'
Description: The line terminator string.
generateFields
Type: function
Default: A generator which includes date/time (as ISO 8601 string), log level, message, and JSON-serialized context and extra objects.
Description: A function to map each log record to an array of strings which represent the fields of each CSV line.