@livy/csv-formatter
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

@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.

Package Sidebar

Install

npm i @livy/csv-formatter

Weekly Downloads

0

Version

1.0.4

License

MIT

Unpacked Size

7.4 kB

Total Files

6

Last publish

Collaborators

  • loilo