Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

winston-csv-format

pustovitDmytro1.4kMIT2.0.3

writes winston logs in csv format

csv, logs, winston, formatter, parse, export, Excel, Google Spreadsheet, comma-separated values, reports

readme

winston-csv-format

writes winston logs in csv format.

Version Bundle size Downloads

CodeFactor SonarCloud Codacy Total alerts Language grade Scrutinizer

Dependencies Security Build Status Coverage Status

Commit activity FOSSA License

🇺🇦 Help Ukraine

I woke up on my 26th birthday at 5 am from the blows of russian missiles. They attacked the city of Kyiv, where I live, as well as the cities in which my family and friends live. Now my country is a war zone.

We fight for democratic values, for freedom, for our future! I am stopping any support of my packages by the time until all russians leave my country on trucks or in boxes.

💛💙 Help Ukraine! We need your support! There are dozen ways to help us, just do it!

Table of Contents

Motivation

If you're struggling to format your logs/reports as .csv files (or prepare import to Excel or Google Spreadsheet), this package can be a cure. Now you can use all power of winston logger, formating your data as comma-separated values.

Requirements

Platform Status

To use library you need to have node and npm installed in your machine:

  • node >=10
  • npm >=6

Package is continuously tested on darwin, linux and win32 platforms. All active and maintenance LTS node releases are supported.

Installation

To install the library run the following command

  npm i --save winston-csv-format

Usage

The package can be used as the formatter alongside any winston transport. Default export is a constructor function. It has 2 arguments: an array of fields and an options object. Note that fields must match keys of logged objects:

import CSV from 'winston-csv-format';
import { createLogger, transports } from 'winston';

const csvHeaders = {
    created : 'Creation Date',
    size    : 'Size',
    status  : 'Status'
};

const logger = createLogger({
    level      : 'info',
    format     : CSV([ 'created', 'status' ], { delimiter: ',' }),
    transports : [ new transports.Console() ]
});

logger.log('info', csvHeaders); // write headers

Configuration

Next values can be configured as options:

  • delimiter - delimiter between fields (';' by default)
  • missed - value, used when original value is missed in the logged object (empty string by default)

Migration Guide

Check Migration Guide to upgrade the next major version. Upgrade to minor/patch versions should happen without additional interventions. See detailed Changelog for a list of changes.

Contribute

Make the changes to the code and tests. Then commit to your branch. Be sure to follow the commit message conventions. Read Contributing Guidelines for details.

changelog

2.0.3 (2022-02-28)

Chore

  • fixes some npm audit vulnerabilities (#60) (a2bb84b), closes #60
  • fixes some npm audit vulnerabilities (#61) (f695d18), closes #61
  • Lock file maintenance (#49) (8222546), closes #49
  • Lock file maintenance (#57) (d623e46), closes #57
  • Lock file maintenance (#63) (62a54cd), closes #63
  • Update dependency nanoid to 3.1.31 [SECURITY] (#56) (107d4e9), closes #56
  • Update dependency node-fetch to 2.6.7 [SECURITY] (#59) (e94c7f3), closes #59

Docs

2.0.2 (2022-01-22)

Chore

  • (ci) fix gitleaks version (badd1c1)
  • adds a security policy (ed86aba)
  • adds bump strategy for devDependencies (non-major) (03c9587)
  • adds circle-ci conditions (5a40980)
  • adds gitleaks to circle pipeline (114946e)
  • adds sponsorships (35ed8e0)
  • adds telegra.ph release notes (aa811a5)
  • adds whitesorce bolt bot (0888eee)
  • calc fossa results in cirrus (b2b48c1)
  • change renovate schedule (b983eab)
  • drop semantic-release preinstalled plugins (69b1950)
  • enhance own updates commit messages (49a2365)
  • fixes audit (14597ff)
  • fixes audit [devDependencies] (d08b1fc)
  • fixes later schedule (a0cfb5c)
  • fixes some npm audit vulnerabilities (9330c38)
  • fixes some npm audit vulnerabilities (f7a14d5)
  • integrate lalaps (dd4f238)
  • Lock file maintenance (cd4a2d8)
  • Lock file maintenance (29fe760)
  • Lock file maintenance (9892cc5)
  • Lock file maintenance (98e62b3)
  • Lock file maintenance (7af4484)
  • Lock file maintenance (1ffc991)
  • Lock file maintenance (47bfacf)
  • Lock file maintenance (19c2389)
  • Lock file maintenance (2b00aec)
  • Lock file maintenance (dea06c9)
  • Lock file maintenance (e0043d8)
  • Lock file maintenance (e8b62cd)
  • Lock file maintenance (5d305a8)
  • Lock file maintenance (#37) (f80afc8), closes #37
  • not allow to fail on node 16 (22ed683)
  • replace appveyor to actions (13aff75)
  • test-security in separete ci job (a4bd846)
  • test-security in separete ci job (9559dbc)
  • Update commitlint monorepo to v13 (f011280)
  • Update dependency eslint-plugin-regexp to v1 (15e27cb)
  • Update dependency eslint-plugin-sonarjs to ^0.10.0 (b24d763)
  • Update dependency eslint-plugin-unicorn to v35 (69f40cd)
  • Update dependency eslint-plugin-unicorn to v36 (ead0aa5)
  • update deps badge (0836169)
  • Update devDependencies (non-major) (609151a)
  • Update devDependencies (non-major) (5b1a6c3)
  • Update devDependencies (non-major) (51200bf)
  • Update devDependencies (non-major) (33211c3)
  • Update devDependencies (non-major) (#48) (b3f6184), closes #48
  • Update devDependencies (non-major) to v13 (6894ad9)
  • Update semantic-release monorepo (4d0deb8)
  • upgrade semantic-release to v.19 [security] (0888454)

Docs

2.0.1 (2021-07-24)

Docs

2.0.0 (2021-07-15)

Breaking

  • Move winston to peerDependencies, fixes #30 (a8793be), closes #30

Chore

  • adds 'typo' PR template (e20404d)
  • adds CODE_OF_CONDUCT (a969a8d)
  • adds sonarcloud config (c92973d)
  • combine mine packages in renovate updates (54c97b8)
  • create auto pr for major dependencies (d2583a6)
  • fixes renovate config (982abaf)
  • Lock file maintenance (cdf4f11)
  • Update dependency eslint-plugin-regexp to ^0.12.0 (51ff304)
  • Update dependency eslint-plugin-regexp to ^0.13.0 (6f9a5d0)
  • Update dependency eslint-plugin-regexp to ^0.13.0 (#36) (3a8d3ec), closes #36
  • Update dependency eslint-plugin-sonarjs to ^0.9.0 (574abb4)
  • Update dependency eslint-plugin-sonarjs to ^0.9.0 (81d9681)
  • Update dependency eslint-plugin-unicorn to v34 (f9fda57)
  • Update dependency eslint-plugin-unicorn to v34 (#34) (86efbac), closes #34
  • Update dependency husky to v7 (3578711)
  • Update dependency husky to v7 (c9c118b)

Docs

1.2.4 (2021-07-01)

Chore

  • adds stabilityDays to renovate (3b262bc)
  • export default in tests (9d210e6)
  • fix json in renovate (8ad7928)
  • fix lint (46faadb)
  • fixes npm audit (c3beccd)
  • fixes tests for windows (d55d98f)
  • integrate fossa (b65e961)
  • integrate node-package-tester (9d53bf3)
  • Lock file maintenance (fa0967a)
  • Lock file maintenance (459de5e)
  • Lock file maintenance (3291a21)
  • removes unused devDependencies (ddb100a)
  • set YARGS_MIN_NODE_VERSION 10 (9b6bef9)
  • Update dependency eslint-plugin-regexp to ^0.12.0 (babc607)
  • Update dependency eslint-plugin-unicorn to v33 (bfa00ff)
  • Update dependency eslint-plugin-unicorn to v33 (f9a2e0d)
  • Update dependency glob-parent to 5.1.2 [SECURITY] (c957512)
  • Update dependency glob-parent to 5.1.2 [SECURITY] (d996348)
  • Update dependency mocha to v9 (93b7a17)
  • update eslint (6b174b1)
  • update eslint-config-incredible (2f39edb)
  • update eslint-config-incredible (58c31d2)

Docs

Fix

  • set babel target node version to 10 (f736568)

1.2.3 (2021-05-25)

Chore

  • 'Chore' semanticCommitType for updating devDependencies (4bf79e1)
  • (tests) clearCache on module load is optional (96c2ae5)
  • additional quotes in glob pattern (f6d15cf)
  • adds appveyor (d560b4e)
  • contributor login in danger message (76349e6)
  • dont store package-tests artifacts (50ebff1)
  • fixes prevent require handler (7923f0e)
  • integrate APPVEYOR_BUILD_ID to build tests (16cdd48)
  • not fail package if no tmp exists (5693813)
  • package-tester improvements (d5d868b)
  • prevent package:test from using devdependencies (dc896f3)
  • update default renovate rules (7e83bc4)

Docs

  • adds node releases roadmap (ba16142)
  • move Contributing Guidelines to separate file. (081e4ed)

1.2.2 (2021-05-25)

Chore

  • (tests) moves load to factory (4acb941)
  • fixes spellcheck in bugreport (7d754b6)
  • set myself as default assignee in pr (0dcd0ce)
  • tests/entry.js module resolving (c840f8b)
  • Update dependency @rollup/plugin-commonjs to v19 (bf29948)
  • update eslint (4aac03c)
  • update lock file (4ffb878)

Upgrade

  • Bump browserslist from 4.16.3 to 4.16.6 (e98f999)

1.2.1 (2021-05-05)

Upgrade

  • Pin dependency winston to 3.3.3 (9e92162)

1.2.0 (2021-05-05)

Chore

  • (refactor) remove unused argument (6f28b59)
  • adds CIRCLE_SKIP_DEPLOY variable (231549d)
  • adds danger to circle-ci (ae48ac3)
  • adds danger to validate pr (7fb7040)
  • adds danger token to circle (82f4156)
  • adds dangerfile to npm ignore (8842c70)
  • adds dummy line to calc coverage (800de67)
  • adds empty line to pr comment (36d8a09)
  • adds jscpd to ignore (8520cea)
  • adds lock file lint (f5a4679)
  • adds pr context (ce163d9)
  • adds technical dept check (e16a8e2)
  • adds test-results to circle-ci (767c5b3)
  • adds tests for packing process (9b9602d)
  • adds tests for prior node versions (4b00012)
  • adds trusted bots to danger (892f4a1)
  • change tgz label (5e0e512)
  • corrected extglob matching (72a2201)
  • corrected pack pattern (273497a)
  • deploy ci as single command (96c2800)
  • deploy in circle-ci (a62a5f2)
  • disable build for coverage check (0b6e984)
  • dont pin devDeps in renovate (5fb0e8d)
  • exit code 0 when skip (f6ee0bf)
  • fill test entry with template (9177859)
  • fixes Breaking increment in semantic-release (d1c4d53)
  • fixes ci (0576a01)
  • Fixes danger-pr in circe-ci (adff8b3)
  • fixes debt typo in travis job (f9fd463)
  • fixes package process (364e26b)
  • fixes renovate config (05c5bc5)
  • ignoring all for npm packaging (409201a)
  • inverse logical condition (65dd0ad)
  • multi os tests for travis (7c8ce28)
  • run pr workflow only for pull requests (03e0b08)
  • split circle ci jobs (9f75a6b)
  • telegram notifications on release (3a8036a)
  • update .renovaterc to automerge after successfull checks (2e76ceb)
  • Update dependency @rollup/plugin-node-resolve to v13 (265fd82)
  • Update dependency babel-plugin-module-resolver to v4 (b8eb86f)
  • Update dependency eslint to v7 (0e79e0f)
  • Update dependency fs-extra to v10 (a0adecc)
  • Update dependency mocha to v8 (627a45b)
  • Update dependency nyc to v15 (1caf199)
  • Update dependency uuid to v8 (ebae34b)
  • Update issue templates (8fdb1af)
  • Update pr template (1d4eb34)
  • update semantic to use commit convention (7e079b2)
  • Update semantic-release monorepo (b7ab2b1)
  • update travis badge (e159104)
  • updates semanticCommitType rule (1a1d119)
  • upgrade circle-ci to 2.1 (fab79a9)
  • use danger for internall pr (d838ede)
  • use incredible eslint config (b03d74a)
  • use native tarball generation (eeefda5)
  • using static test entry (21e5b7d)

Docs

Fix

New

1.1.1 (2021-04-08)

Chore

  • (git) Add logs to gitignore (d4d2077)
  • adds commitlint (38ded63)
  • adds target branch to semantic release (c4fb3f1)
  • change extention of test files to .test.js (d84ac03)
  • pull last boilerplate (b2611c2)
  • update semantic release rules (a075dab)

Fix

Upgrade

1.1.0 (2020-05-07)

1.0.0 (2019-08-06)

Chore

New