npm.io
2.0.0 • Published 4 years ago

@springernature/util-cli-reporter

Licence
MIT
Version
2.0.0
Deps
2
Size
226 kB
Vulns
0
Weekly
0

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