log-process-errors
Show some ❤️ to process errors
Last updated 3 months ago by ehmicky .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install log-process-errors 
SYNC missed versions from official npm registry.

Codecov Travis Node Gitter Twitter Medium

???? Medium article.

Show some ❤️ to Node.js process errors.

Node.js prints process errors (uncaughtException, warning, unhandledRejection, rejectionHandled) on the console which is very useful. Unfortunately those errors:

log-process-errors fixes all those issues.

Without log-process-errors:

Screenshot before

With log-process-errors:

Screenshot after

Use cases

  • Proper logging of process errors in production.
  • Debugging of process errors in development.
  • Automated testing of process errors.

Demo

You can try this library:

Install

Production code (e.g. a server) can install this either as a production or development dependency:

npm install log-process-errors

However, libraries should install this as a development dependency:

npm install -D log-process-errors

This is because logging is modified globally and libraries users might not expect this side-effect. Also, this might lead to conflicts between libraries.

Usage

There are two ways to load this library. The first is to use the node -r CLI flag:

node -r log-process-errors/build/register ...

The second is:

const logProcessErrors = require('log-process-errors')
logProcessErrors(options)

logProcessErrors() should be called as early as possible in the code, before other require/import statements.

Options

options is an optional object with the following properties.

log

Type: function(error, level, originalError)

Customizes how process errors are logged.
Full documentation.

level

Type: object
Default: { warning: 'warn', multipleResolves: 'info', default: 'error' }

Which log level to use.
Full documentation.

exitOn

Type: string[]
Default: ['uncaughtException']

Which process errors should trigger process.exit(1).
Full documentation.

testing

Type: string
Value: 'ava', 'mocha', 'jasmine', 'tape' or 'node-tap'
Default: undefined

When running tests, makes them fail if there are any process errors.
Full documentation.

colors

Type: boolean
Default: true if the output is a terminal.

Colorizes messages.
Full documentation.

Support

If you found a bug or would like a new feature, don't hesitate to submit an issue on GitHub.

For other questions, feel free to chat with us on Gitter.

Everyone is welcome regardless of personal background. We enforce a Code of conduct in order to promote a positive and inclusive environment.

Contributing

This project was made with ❤️. The simplest way to give back is by starring and sharing it online.

If the documentation is unclear or has a typo, please click on the page's Edit button (pencil icon) and suggest a correction.

If you would like to help us fix a bug or add a new feature, please check our guidelines. Pull requests are welcome!

Thanks go to our wonderful contributors:

ehmicky
ehmicky

???? ???? ???? ????
Steven Vachon
Steven Vachon

????
Hongarc
Hongarc

???? ????

Current Tags

  • 6.1.1                                ...           latest (3 months ago)

69 Versions

  • 5.1.2                                ...           3 months ago
  • 6.1.1                                ...           3 months ago
  • 5.1.1                                ...           3 months ago
  • 5.1.0                                ...           3 months ago
  • 6.1.0                                ...           3 months ago
  • 6.0.1                                ...           3 months ago
  • 6.0.0                                ...           6 months ago
  • 5.0.3                                ...           8 months ago
  • 5.0.2                                ...           a year ago
  • 5.0.1                                ...           a year ago
  • 5.0.0                                ...           a year ago
  • 4.1.1                                ...           a year ago
  • 4.1.0                                ...           a year ago
  • 4.0.0                                ...           a year ago
  • 3.4.2                                ...           a year ago
  • 3.4.0                                ...           a year ago
  • 3.3.0                                ...           a year ago
  • 3.2.3                                ...           a year ago
  • 3.2.2                                ...           a year ago
  • 3.2.1                                ...           a year ago
  • 3.2.0                                ...           a year ago
  • 3.1.3                                ...           a year ago
  • 3.1.2                                ...           a year ago
  • 3.0.0                                ...           a year ago
  • 2.1.1                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.2.0                                ...           a year ago
  • 1.1.2                                ...           a year ago
  • 1.1.1                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.14.2                                ...           2 years ago
  • 0.14.1                                ...           2 years ago
  • 0.14.0                                ...           2 years ago
  • 0.13.21                                ...           2 years ago
  • 0.13.20                                ...           2 years ago
  • 0.13.19                                ...           2 years ago
  • 0.13.17                                ...           2 years ago
  • 0.13.16                                ...           2 years ago
  • 0.13.15                                ...           2 years ago
  • 0.13.14                                ...           2 years ago
  • 0.13.13                                ...           2 years ago
  • 0.13.12                                ...           2 years ago
  • 0.13.11                                ...           2 years ago
  • 0.13.9                                ...           2 years ago
  • 0.13.6                                ...           2 years ago
  • 0.13.2                                ...           2 years ago
  • 0.13.1                                ...           2 years ago
  • 0.13.0                                ...           2 years ago
  • 0.12.1                                ...           2 years ago
  • 0.12.0                                ...           2 years ago
  • 0.11.7                                ...           2 years ago
  • 0.11.6                                ...           2 years ago
  • 0.11.3                                ...           2 years ago
  • 0.11.2                                ...           2 years ago
  • 0.11.0                                ...           2 years ago
  • 0.11.1                                ...           2 years ago
  • 0.10.0                                ...           2 years ago
  • 0.9.1                                ...           2 years ago
  • 0.9.0                                ...           2 years ago
  • 0.8.0                                ...           2 years ago
  • 0.7.0                                ...           2 years ago
  • 0.6.0                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.2                                ...           2 years ago
  • 0.4.0                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 33
This Month 127
Last Day 5
Last Week 248
Last Month 1,119
Dependencies (7)
Dev Dependencies (15)

Copyright 2014 - 2016 © taobao.org |