Open In App

Node.js process.report.getReport([err]) Function

Last Updated : 22 Dec, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The process.report.gerReport() is a method of process.report javascript object that helps generate a report of the currently running node.js process.

Syntax:

process.report.getReport([err])

Parameters: It takes an array of Error Object that represents a custom error in the javascript stack

Return Value: It returns a javascript object that represents a report for the running process.

Example 1: In this example, we will simply log the currently running process’s report to the console.

Filename: index.js

Javascript




const { report } = require('node:process');
console.log(report.getReport());


Command to run:

node index.js

Output:

 

Example 2: In this example, we will print the command line of the running process’s header to the console.

Filename: index.js

Javascript




const { report } = require('node:process');
console.log(report.getReport().header.commandLine);


Command to run:

node index.js

Output:

 

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


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads