@@ -1659,107 +1659,104 @@ In custom builds from non-release versions of the source tree, only the
16591659relied upon to exist.
16601660
16611661## process.report
1662+ <!-- YAML
1663+ added: v11.8.0
1664+ -->
1665+
1666+ * {Object}
1667+
1668+ `process.report` is an object whose methods are used to generate diagnostic
1669+ reports for the current process. Additional documentation is available in the
1670+ [report documentation][].
16621671
16631672### process.report.getReport([err])
16641673<!-- YAML
16651674added: v11.8.0
16661675-->
16671676
1668- * `err` {Object}
1669- * Returns: {Object} Returns the diagnostics report as an `Object`.
1677+ * `err` {Error} A custom error used for reporting the JavsScript stack.
1678+ * Returns: {string}
16701679
1671- Generates a JSON-formatted diagnostic report summary of the running process.
1672- The report includes JavaScript and native stack traces, heap statistics,
1673- platform information, resource usage etc.
1680+ Returns a JSON-formatted diagnostic report for the running process. The report's
1681+ JavaScript stack trace is taken from `err`, if present.
16741682
16751683```js
16761684const data = process.report.getReport();
16771685console.log(data);
16781686```
16791687
1680- Additional documentation on diagnostic report is available
1681- at [report documentation][].
1688+ Additional documentation is available in the [report documentation][].
16821689
16831690### process.report.setDiagnosticReportOptions([options]);
16841691<!-- YAML
16851692added: v11.8.0
16861693-->
16871694
1688- Set the runtime configuration of diagnostic report data capture. Upon invocation
1689- of this function, the runtime is reconfigured to generate report based on
1690- the new input.
1691-
16921695* `options` {Object}
16931696 * `events` {string[]}
1694- * `signal`: generate a report in response to a signal raised on the process.
1695- * `exception`: generate a report on unhandled exceptions.
1696- * `fatalerror`: generate a report on internal fault
1697+ * `signal`: Generate a report in response to a signal raised on the process.
1698+ * `exception`: Generate a report on unhandled exceptions.
1699+ * `fatalerror`: Generate a report on internal fault
16971700 (such as out of memory errors or native assertions).
1698- * `signal` {string} sets or resets the signal for report generation
1701+ * `signal` {string} Sets or resets the signal for report generation
16991702 (not supported on Windows). **Default:** `'SIGUSR2'`.
1700- * `filename` {string} name of the file to which the report will be written.
1701- * `path` {string} drectory at which the report will be generated .
1703+ * `filename` {string} Name of the file where the report is written.
1704+ * `path` {string} Directory where the report is written .
17021705 **Default:** the current working directory of the Node.js process.
1703- * `verbose` {boolean} flag that controls additional verbose information on
1706+ * `verbose` {boolean} Flag that controls additional verbose information on
17041707 report generation. **Default:** `false`.
17051708
1709+ Configures the diagnostic reporting behavior. Upon invocation, the runtime
1710+ is reconfigured to generate reports based on `options`. Several usage examples
1711+ are shown below.
1712+
17061713```js
1707- // Trigger a report upon uncaught exceptions or fatal erros.
1708- process.report.setDiagnosticReportOptions(
1709- { events: ['exception', 'fatalerror'] });
1714+ // Trigger a report on uncaught exceptions or fatal errors.
1715+ process.report.setDiagnosticReportOptions({
1716+ events: ['exception', 'fatalerror']
1717+ });
17101718
17111719// Change the default path and filename of the report.
1712- process.report.setDiagnosticReportOptions(
1713- { filename: 'foo.json', path: '/home' });
1720+ process.report.setDiagnosticReportOptions({
1721+ filename: 'foo.json',
1722+ path: '/home'
1723+ });
17141724
17151725// Produce the report onto stdout, when generated. Special meaning is attached
17161726// to `stdout` and `stderr`. Usage of these will result in report being written
17171727// to the associated standard streams. URLs are not supported.
1718- process.report.setDiagnosticReportOptions(
1719- { filename: 'stdout' });
1728+ process.report.setDiagnosticReportOptions({ filename: 'stdout' });
17201729
17211730// Enable verbose option on report generation.
1722- process.report.setDiagnosticReportOptions(
1723- { verbose: true });
1724-
1731+ process.report.setDiagnosticReportOptions({ verbose: true });
17251732```
17261733
17271734Signal based report generation is not supported on Windows.
17281735
1729- Additional documentation on diagnostic report is available
1730- at [report documentation][].
1736+ Additional documentation is available in the [report documentation][].
17311737
17321738### process.report.triggerReport([filename][, err])
17331739<!-- YAML
17341740added: v11.8.0
17351741-->
17361742
1737- * `filename` {string} The file to write into. The `filename` should be
1738- a relative path, that will be appended to the directory specified by
1739- `process.report.setDiagnosticReportOptions`, or current working directory
1740- of the Node.js process, if unspecified.
1741- * `err` {Object} A custom object which will be used for reporting
1742- JavsScript stack.
1743+ * `filename` {string} Name of the file where the report is written. This
1744+ should be a relative path, that will be appended to the directory specified in
1745+ `process.report.setDiagnosticReportOptions`, or the current working directory
1746+ of the Node.js process, if unspecified.
1747+ * `err` {Error} A custom error used for reporting the JavsScript stack.
17431748
17441749* Returns: {string} Returns the filename of the generated report.
17451750
1746- If both `filename` and `err` object are passed to `triggerReport()` the
1747- `err` object must be the second parameter.
1748-
1749- Triggers and produces the report (a JSON-formatted file with the internal
1750- state of Node.js runtime) synchronously, and writes into a file.
1751+ Writes a diagnostic report to a file. If `filename` is not provided, the default
1752+ filename includes the date, time, PID, and a sequence number. The report's
1753+ JavaScript stack trace is taken from `err`, if present.
17511754
17521755```js
17531756process.report.triggerReport();
17541757```
17551758
1756- When a report is triggered, start and end messages are issued to stderr and the
1757- filename of the report is returned to the caller. The default filename includes
1758- the date, time, PID and a sequence number. Alternatively, a filename and error
1759- object can be specified as parameters on the `triggerReport()` call.
1760-
1761- Additional documentation on diagnostic report is available
1762- at [report documentation][].
1759+ Additional documentation is available in the [report documentation][].
17631760
17641761## process.send(message[, sendHandle[, options]][, callback])
17651762<!-- YAML
0 commit comments