This repository was archived by the owner on Jun 18, 2021. It is now read-only.
Repository navigation
Opt-in hooks and signal by default - #33
Closed
rnchamberlain wants to merge 2 commits into
Closed
rnchamberlain wants to merge 2 commits into
rnchamberlain wants to merge 2 commits into
Conversation
This changes the default action on require('nodereport') to opt-in
to the exception and fatal-error hooks, and to enable the signal
handler. So 'node -r nodereport application.js' will get all the
nodereport functionality without any application code changes.
For users programming to the API, a separate api-only entry point,
require('nodereport/api') is provided. This does not enable the
hooks and signal unless and until .setEvents() is called.
Contributor
Author
|
@sam-github @richardlau @Fishrock123 this should be the same as the final version in the earlier PR #28 but a quick re-review would be much appreciated - thanks |
richardlau
approved these changes
Dec 14, 2016
sam-github
approved these changes
Dec 14, 2016
sam-github
left a comment
Contributor
There was a problem hiding this comment.
Maybe a test, at least a positive one? For example, test-api.js should require ../api to ensure it remains requireable?
| const api = require('./api'); | ||
|
|
||
| // Process NODEREPORT_EVENTS env var | ||
| const options = process.env.NODEREPORT_EVENTS; |
Contributor
There was a problem hiding this comment.
You can simplify and remove the conditional if you want:
const options = process.env.NODEREPORT_EVENTS || 'exception+fatalerror+signal+apicall';
api.setEvents(options);
Contributor
Author
|
@sam-github agree, needs a positive test for |
rnchamberlain
added a commit
that referenced
this pull request
Dec 21, 2016
This changes the default action on require('nodereport') to opt-in
to the exception and fatal-error hooks, and to enable the signal
handler. So 'node -r nodereport application.js' will get all the
nodereport functionality without any application code changes.
For users programming to the API, a separate api-only entry point,
require('nodereport/api') is provided. This does not enable the
hooks and signal unless and until .setEvents() is called.
PR-URL: #33
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Contributor
Author
|
Landed as 8605e4c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changes the default action on require('nodereport') to opt-in to the exception and fatal-error hooks, and to enable the signal handler. So 'node -r nodereport application.js' will get all the nodereport functionality without any application code changes.
For users programming to the API, a separate api-only entry point, require('nodereport/api') is provided. This does not enable the hooks and signal unless and until .setEvents() is called.
Addresses issue #25
This is a follow-on from PR #28