Node.js – process.report Property

process.report is an object whose methods generate the diagnostic reports for the current process. It is found under the process module.

Syntax

process.report

Example 1

Create a file with the name "report.js" and copy the following code snippet. After creating the file, use the command "node report.js" to run this code.

// process.report Demo Example

// Importing the process module
const process = require('process');

// Getting reports for the below processes
const reports = process.report;

// Printing out the result
console.log(reports)

Output

uC:\home\node>> node report.js
{
   writeReport: [Function: writeReport],
   getReport: [Function: getReport],
   directory: [Getter/Setter],
   filename: [Getter/Setter],
   compact: [Getter/Setter],
   signal: [Getter/Setter],
   reportOnFatalError: [Getter/Setter],
   reportOnSignal: [Getter/Setter],
   reportOnUncaughtException: [Getter/Setter]
}

Example 2

Let’s take a look at one more example.

// process.report Demo Example

// Importing the process module
const process = require('process');

// Getting reports for the below processes
const reports = process.report;

// Checking if the report is present
if (process.report) {
  // printing compact Status
   console.log(process.report.compact)
} else {
   console.log("No data to print compact status")
}

Output

No data to print compact status
Updated on: 2021-10-29T07:58:52+05:30

257 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements