Skip to content

Commit

Permalink
report: rename setDiagnosticReportOptions()
Browse files Browse the repository at this point in the history
setDiagnosticReportOptions() is a method on process.report,
making the "DiagnosticReport" part redundant. Rename the
function to setOptions().

PR-URL: #25990
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
cjihrig authored and targos committed Feb 10, 2019
1 parent c8ceece commit 88019b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
19 changes: 7 additions & 12 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ console.log(data);

Additional documentation is available in the [report documentation][].

### process.report.setDiagnosticReportOptions([options]);
### process.report.setOptions([options]);
<!-- YAML
added: v11.8.0
-->
Expand All @@ -1712,23 +1712,18 @@ are shown below.

```js
// Trigger a report on uncaught exceptions or fatal errors.
process.report.setDiagnosticReportOptions({
events: ['exception', 'fatalerror']
});
process.report.setOptions({ events: ['exception', 'fatalerror'] });

// Change the default path and filename of the report.
process.report.setDiagnosticReportOptions({
filename: 'foo.json',
path: '/home'
});
process.report.setOptions({ filename: 'foo.json', path: '/home' });

// Produce the report onto stdout, when generated. Special meaning is attached
// to `stdout` and `stderr`. Usage of these will result in report being written
// to the associated standard streams. URLs are not supported.
process.report.setDiagnosticReportOptions({ filename: 'stdout' });
process.report.setOptions({ filename: 'stdout' });

// Enable verbose option on report generation.
process.report.setDiagnosticReportOptions({ verbose: true });
process.report.setOptions({ verbose: true });
```

Signal based report generation is not supported on Windows.
Expand All @@ -1742,8 +1737,8 @@ added: v11.8.0

* `filename` {string} Name of the file where the report is written. This
should be a relative path, that will be appended to the directory specified in
`process.report.setDiagnosticReportOptions`, or the current working directory
of the Node.js process, if unspecified.
`process.report.setOptions`, or the current working directory of the Node.js
process, if unspecified.
* `err` {Error} A custom error used for reporting the JavsScript stack.

* Returns: {string} Returns the filename of the generated report.
Expand Down
10 changes: 5 additions & 5 deletions doc/api/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,10 @@ times for the same Node.js process.
## Configuration

Additional runtime configuration that influences the report generation
constraints are available using `setDiagnosticReportOptions()` API.
constraints are available using `setOptions()` API.

```js
process.report.setDiagnosticReportOptions({
process.report.setOptions({
events: ['exception', 'fatalerror', 'signal'],
signal: 'SIGUSR2',
filename: 'myreport.json',
Expand Down Expand Up @@ -481,13 +481,13 @@ pertinent to the report generation. Defaults to `false`.

```js
// Trigger report only on uncaught exceptions.
process.report.setDiagnosticReportOptions({ events: ['exception'] });
process.report.setOptions({ events: ['exception'] });

// Trigger report for both internal errors as well as external signal.
process.report.setDiagnosticReportOptions({ events: ['fatalerror', 'signal'] });
process.report.setOptions({ events: ['fatalerror', 'signal'] });

// Change the default signal to `SIGQUIT` and enable it.
process.report.setDiagnosticReportOptions(
process.report.setOptions(
{ events: ['signal'], signal: 'SIGQUIT' });
```

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/process/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let config = {
verbose: false
};
const report = {
setDiagnosticReportOptions(options) {
setOptions(options) {
emitExperimentalWarning('report');
const previousConfig = config;
const newConfig = {};
Expand Down

0 comments on commit 88019b0

Please sign in to comment.