@@ -1659,107 +1659,104 @@ In custom builds from non-release versions of the source tree, only the
1659
1659
relied upon to exist.
1660
1660
1661
1661
## 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] [ ] .
1662
1671
1663
1672
### process.report.getReport([ err] )
1664
1673
<!-- YAML
1665
1674
added: v11.8.0
1666
1675
-->
1667
1676
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}
1670
1679
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.
1674
1682
1675
1683
``` js
1676
1684
const data = process .report .getReport ();
1677
1685
console .log (data);
1678
1686
```
1679
1687
1680
- Additional documentation on diagnostic report is available
1681
- at [ report documentation] [ ] .
1688
+ Additional documentation is available in the [ report documentation] [ ] .
1682
1689
1683
1690
### process.report.setDiagnosticReportOptions([ options] );
1684
1691
<!-- YAML
1685
1692
added: v11.8.0
1686
1693
-->
1687
1694
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
-
1692
1695
* ` options ` {Object}
1693
1696
* ` 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
1697
1700
(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
1699
1702
(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 .
1702
1705
** 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
1704
1707
report generation. ** Default:** ` false ` .
1705
1708
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
+
1706
1713
``` 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
+ });
1710
1718
1711
1719
// 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
+ });
1714
1724
1715
1725
// Produce the report onto stdout, when generated. Special meaning is attached
1716
1726
// to `stdout` and `stderr`. Usage of these will result in report being written
1717
1727
// to the associated standard streams. URLs are not supported.
1718
- process .report .setDiagnosticReportOptions (
1719
- { filename: ' stdout' });
1728
+ process .report .setDiagnosticReportOptions ({ filename: ' stdout' });
1720
1729
1721
1730
// Enable verbose option on report generation.
1722
- process .report .setDiagnosticReportOptions (
1723
- { verbose: true });
1724
-
1731
+ process .report .setDiagnosticReportOptions ({ verbose: true });
1725
1732
```
1726
1733
1727
1734
Signal based report generation is not supported on Windows.
1728
1735
1729
- Additional documentation on diagnostic report is available
1730
- at [ report documentation] [ ] .
1736
+ Additional documentation is available in the [ report documentation] [ ] .
1731
1737
1732
1738
### process.report.triggerReport([ filename] [ , err ] )
1733
1739
<!-- YAML
1734
1740
added: v11.8.0
1735
1741
-->
1736
1742
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.
1743
1748
1744
1749
* Returns: {string} Returns the filename of the generated report.
1745
1750
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.
1751
1754
1752
1755
``` js
1753
1756
process .report .triggerReport ();
1754
1757
```
1755
1758
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] [ ] .
1763
1760
1764
1761
## process.send(message[ , sendHandle[ , options]] [ , callback ] )
1765
1762
<!-- YAML
0 commit comments