@@ -10,19 +10,28 @@ Log all process errors on the console (or using a custom logger):
1010
1111![ Screenshot] ( docs/screenshot.png )
1212
13- # Usage
13+ # Usage (preferred)
14+
15+ Require this module with the ` -r ` CLI flag.
16+
17+ ``` bash
18+ node -r log-process-errors ...
19+ ```
20+
21+ # Usage (custom)
22+
23+ In order to customize options, ` log-process-errors/custom ` must be required
24+ like this instead:
1425
1526<!-- eslint-disable no-unused-vars, node/no-missing-require,
1627import/no-unresolved, unicorn/filename-case, strict, no-undef -->
1728
1829``` js
19- const logProcessErrors = require (' log-process-errors' )
30+ const logProcessErrors = require (' log-process-errors/custom ' )
2031
2132logProcessErrors (options)
2233```
2334
24- # Options
25-
2635` options ` is an optional object with the following properties:
2736
2837- [ ` log ` ` {function} ` ] ( #custom-logging )
@@ -31,6 +40,14 @@ logProcessErrors(options)
3140- [ ` colors ` ` {boolean} ` ] ( #log-message ) (default: ` false ` )
3241- [ ` skipEvent ` ` {function} ` ] ( #skipping-events )
3342
43+ ` logProcessErrors() ` should be called as early as possible in the code.
44+
45+ ` log-process-errors ` modifies logging globally. This is not recommended for
46+ libraries since their users might not expect this side effect. Also this might
47+ lead to conflicts between libraries. Libraries should use the
48+ [ ` -r log-process-errors ` CLI flag] ( #usage-preferred ) instead of
49+ [ ` require() ` ] ( #usage-custom ) .
50+
3451# Custom logging
3552
3653By default events will be logged to the console (e.g. ` console.error() ` ).
0 commit comments