Open In App

Node.js process.report.writeReport() Method

The process.report.writeReport() method writes a diagnostic report to a file. If filename is not provided, the default filename includes the date, time, PID, and a sequence number. The report’s JavaScript stack trace is taken from err, if present.

Syntax:



process.report.writeReport([filename][, err])

Parameters: This method accepts two parameters as mentioned above and described below:

Return Value: This method returns the filename of the generated report.



Below examples illustrate the use of the process.report.writeReport property in Node.js:

Example:




// Node.js program to demonstrate the 
// process.report.writeReport Property 
     
// Include process module 
import process from 'process'
    
// Printing process.report.writeReport property value 
process.report.writeReport();

Command to run:

node filename

Output:

Note: The above program will compile and run by using the node filename.js command.

Reference:https://nodejs.org/api/process.html#process_process_report_reportonsignal

Article Tags :