diff --git a/.npmignore b/.npmignore index f5078ac..cc94b97 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,4 @@ * !src/** !binding.gyp +!index.js diff --git a/README.md b/README.md index 8865428..665aeb6 100644 --- a/README.md +++ b/README.md @@ -15,15 +15,26 @@ Supports Node.js v4, v6 and v7 on Linux, MacOS, Windows and AIX. ```bash npm install nodereport +node -r nodereport app.js ``` +A NodeReport will be triggered automatically on unhandled exceptions and fatal +error events (for example out of memory errors), and can also be triggered +by sending a USR2 signal to a Node.js process (Linux/MacOS only). -This will allow a NodeReport to be triggered via an API -call from a JavaScript application. +A NodeReport can also be triggered via an API call from a JavaScript +application. ```js var nodereport = require('nodereport'); nodereport.triggerReport(); ``` +The API can be used without adding the automatic exception and fatal error +hooks and the signal handler, as follows: + +```js +var nodereport = require('nodereport/api'); +nodereport.triggerReport(); +``` Content of the NodeReport consists of a header section containing the event type, date, time, PID and Node version, sections containing JavaScript and @@ -50,19 +61,12 @@ can be specified as a parameter on the `triggerReport()` call. nodereport.triggerReport("myReportName"); ``` -A NodeReport can also be triggered automatically on unhandled exceptions, fatal -error events (for example out of memory errors), and signals (Linux/MacOS only). -Triggering on these events can be enabled using the following API call: - -```js -nodereport.setEvents("exception+fatalerror+signal+apicall"); -``` - ## Configuration Additional configuration is available using the following APIs: ```js +nodereport.setEvents("exception+fatalerror+signal+apicall"); nodereport.setSignal("SIGUSR2|SIGQUIT"); nodereport.setFileName("stdout|stderr|"); nodereport.setDirectory(""); diff --git a/binding.gyp b/binding.gyp index 3d0be4e..6d4c379 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,7 +1,7 @@ { "targets": [ { - "target_name": "nodereport", + "target_name": "api", "sources": [ "src/node_report.cc", "src/module.cc" ], "include_dirs": [ ' process.exit(2));