Open In App

Node.js process.traceDeprecation Property

Last Updated : 10 Jun, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The process.traceDeprecation property is an inbuilt application programming interface of the process module which is used to indicate whether the –trace-deprecation flag is set on the current Node.js process.

Syntax:

process.traceDeprecation

Return Value: This property indicates whether the –trace-deprecation flag is set on the current Node.js process.

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

 

Example 1:

index.js




// Node.js program to demonstrate the
// process.traceDeprecation Property
  
// Include process module
const process = require('process');
  
// Printing process.traceDeprecation property value
console.log(process.traceDeprecation);


Run the index.js file using the following command:

node --trace-deprecation index.js

Output:

true

Again run the same file, but using the different command as shown below:

node index.js

Output:

undefined

Example 2:

Filename: index.js

Javascript




// Node.js program to demonstrate the
// process.traceDeprecation Property
  
// Include process module
const process = require('process');
  
// Instance Properties 
process.traceDeprecation = false;
  
// Printing process.traceDeprecation
// property value
console.log(process.traceDeprecation);
  
// Instance Properties 
process.traceDeprecation = true;
  
// Printing process.traceDeprecation
// property value
console.log(process.traceDeprecation);


Run the index.js file using the following command:

node --trace-deprecation index.js

Output:

true
true

Again run the same file, but using the different command as shown below:

node index.js

Output:

false
true


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

Similar Reads