@springernature/util-cli-reporter

2.0.0 • Public • Published

CLI Reporter

NPM version Node version MIT License

Standardised command-line reporter for frontend toolkit modules.

Install

$ npm install @springernature/util-cli-reporter

Usage

const reporter = require('@springernature/util-cli-reporter');

// Optionally initialise with a logging level
// Defaults to title (all)
reporter.init('title');

reporter.title('this is a heading');

reporter.info('description');
reporter.info('description', 'this is my message');
reporter.info('description', 'this is my message', 'to you');

reporter.success('description');
reporter.success('description', 'this is my message');
reporter.success('description', 'this is my message', 'to you');

reporter.warning('description');
reporter.warning('description', 'this is my message');
reporter.warning('description', 'this is my message', 'to you');

reporter.fail('description');
reporter.fail('description', 'this is my message');
reporter.fail('description', 'this is my message', 'to you');

NOTE: you can run this demo from demo/index.js

Logging levels

By running the reporter.init() function you can set the following logging levels

reporter.init('title')

  • Prints all reporting types - title, info, success, warning, fail

reporter.init('info')

  • Prints the reporting types - info, success, warning, fail
  • Ignores the reporting types - title

reporter.init('success')

  • Prints the reporting types - success, warning, fail
  • Ignores the reporting types - title, info

reporter.init('warning')

  • Prints the reporting types - warning, fail
  • Ignores the reporting types - title, info, success

reporter.init('fail')

  • Prints the reporting types - fail
  • Ignores the reporting types - title, info, success, warning

reporter.init('none')

  • Ignores all reporting types - title, info, success, warning, fail

Output

example output

License

MIT License © 2019, Springer Nature

Readme

Keywords

none

Package Sidebar

Install

npm i @springernature/util-cli-reporter

Weekly Downloads

46

Version

2.0.0

License

MIT

Unpacked Size

232 kB

Total Files

7

Last publish

Collaborators

  • ndv3997
  • sndigital
  • rseidelsohn
  • testingsabrina
  • roshandeorukhkar-sn
  • benjclark
  • sonniesedge
  • rlau
  • dotcode
  • joseluisbolos
  • hollsk
  • moddular
  • jpw
  • nickcall
  • howlingmad
  • davidpauljunior
  • morgaan