@@ -1658,6 +1658,109 @@ In custom builds from non-release versions of the source tree, only the
1658
1658
` name ` property may be present. The additional properties should not be
1659
1659
relied upon to exist.
1660
1660
1661
+ ## process.report
1662
+
1663
+ ### process.report.getReport([ err] )
1664
+ <!-- YAML
1665
+ added: REPLACEME
1666
+ -->
1667
+
1668
+ * ` err ` {Object}
1669
+ * Returns: {Object} Returns the diagnostics report as an ` Object ` .
1670
+
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.
1674
+
1675
+ ``` js
1676
+ const data = process .report .getReport ();
1677
+ console .log (data);
1678
+ ```
1679
+
1680
+ Additional documentation on diagnostic report is available
1681
+ at [ report documentation] [ ] .
1682
+
1683
+ ### process.report.setDiagnosticReportOptions([ options] );
1684
+ <!-- YAML
1685
+ added: REPLACEME
1686
+ -->
1687
+
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
+ * ` options ` {Object}
1693
+ * ` 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
+ (such as out of memory errors or native assertions).
1698
+ * ` signal ` {string} sets or resets the signal for report generation
1699
+ (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.
1702
+ ** Default:** the current working directory of the Node.js process.
1703
+ * ` verbose ` {boolean} flag that controls additional verbose information on
1704
+ report generation. ** Default:** ` false ` .
1705
+
1706
+ ``` js
1707
+ // Trigger a report upon uncaught exceptions or fatal erros.
1708
+ process .report .setDiagnosticReportOptions (
1709
+ { events: [' exception' , ' fatalerror' ] });
1710
+
1711
+ // Change the default path and filename of the report.
1712
+ process .report .setDiagnosticReportOptions (
1713
+ { filename: ' foo.json' , path: ' /home' });
1714
+
1715
+ // Produce the report onto stdout, when generated. Special meaning is attached
1716
+ // to `stdout` and `stderr`. Usage of these will result in report being written
1717
+ // to the associated standard streams. URLs are not supported.
1718
+ process .report .setDiagnosticReportOptions (
1719
+ { filename: ' stdout' });
1720
+
1721
+ // Enable verbose option on report generation.
1722
+ process .report .setDiagnosticReportOptions (
1723
+ { verbose: true });
1724
+
1725
+ ```
1726
+
1727
+ Signal based report generation is not supported on Windows.
1728
+
1729
+ Additional documentation on diagnostic report is available
1730
+ at [ report documentation] [ ] .
1731
+
1732
+ ### process.report.triggerReport([ filename] [ , err ] )
1733
+ <!-- YAML
1734
+ added: REPLACEME
1735
+ -->
1736
+
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
+
1744
+ * Returns: {string} Returns the filename of the generated report.
1745
+
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
+
1752
+ ``` js
1753
+ process .report .triggerReport ();
1754
+ ```
1755
+
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] [ ] .
1763
+
1661
1764
## process.send(message[ , sendHandle[ , options]] [ , callback ] )
1662
1765
<!-- YAML
1663
1766
added: v0.5.9
@@ -2172,3 +2275,4 @@ cases:
2172
2275
[ note on process I/O ] : process.html#process_a_note_on_process_i_o
2173
2276
[ process_emit_warning ] : #process_process_emitwarning_warning_type_code_ctor
2174
2277
[ process_warning ] : #process_event_warning
2278
+ [ report documentation ] : report.html
0 commit comments