diff --git a/doc/api/process.md b/doc/api/process.md index 85239bcc4ff484..316fac3f5190d5 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1669,6 +1669,21 @@ added: v11.8.0 reports for the current process. Additional documentation is available in the [report documentation][]. +## process.report.directory + + +* {string} + +Directory where the report is written. The default value is the empty string, +indicating that reports are written to the current working directory of the +Node.js process. + +```js +console.log(`Report directory is ${process.report.directory}`); +``` + ### process.report.getReport([err]) -* `options` {Object} - * `events` {string[]} - * `signal`: Generate a report in response to a signal raised on the process. - * `exception`: Generate a report on unhandled exceptions. - * `fatalerror`: Generate a report on internal fault - (such as out of memory errors or native assertions). - * `signal` {string} Sets or resets the signal for report generation - (not supported on Windows). **Default:** `'SIGUSR2'`. - * `filename` {string} Name of the file where the report is written. - * `path` {string} Directory where the report is written. - **Default:** the current working directory of the Node.js process. +* {string} -Configures the diagnostic reporting behavior. Upon invocation, the runtime -is reconfigured to generate reports based on `options`. Several usage examples -are shown below. +Filename where the report is written. If set to the empty string, the output +filename will be comprised of a timestamp, PID, and sequence number. The default +value is the empty string. ```js -// Trigger a report on uncaught exceptions or fatal errors. -process.report.setOptions({ events: ['exception', 'fatalerror'] }); +console.log(`Report filename is ${process.report.filename}`); +``` + +## process.report.reportOnFatalError + + +* {boolean} -// Change the default path and filename of the report. -process.report.setOptions({ filename: 'foo.json', path: '/home' }); +If `true`, a diagnostic report is generated on fatal errors, such as out of +memory errors or failed C++ assertions. -// 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.setOptions({ filename: 'stdout' }); +```js +console.log(`Report on fatal error: ${process.report.reportOnFatalError}`); ``` -Signal based report generation is not supported on Windows. +## process.report.reportOnSignal + -Additional documentation is available in the [report documentation][]. +* {boolean} + +If `true`, a diagnostic report is generated when the process receives the +signal specified by `process.report.signal`. + +```js +console.log(`Report on signal: ${process.report.reportOnSignal}`); +``` + +## process.report.reportOnUncaughtException + + +* {boolean} + +If `true`, a diagnostic report is generated on uncaught exception. + +```js +console.log(`Report on exception: ${process.report.reportOnUncaughtException}`); +``` + +## process.report.signal + + +* {string} + +The signal used to trigger the creation of a diagnostic report. Defaults to +`SIGUSR2`. + +```js +console.log(`Report signal: ${process.report.signal}`); +``` ### process.report.triggerReport([filename][, err])