Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Node.js - process.traceDeprecation() Method
This process.traceDeprecation() method states whether the --trace-deprecation flag is set or not on the current Node.js project. This Boolean flag controls whether the trace of deprecation warning messages are printed or not.
Syntax
process.traceDeprecation( )
Example 1
Create a file with the name "traceDeprecation.js" and copy the following code snippet. After creating the file, use the command "node traceDeprecation.js" to run this code as shown in the example below −
// process.traceDeprecation() Demo Example
// Importing the process module
const process = require('process');
// Printing traceDeprecation default value
console.log(process.traceDeprecation);
Output 1
C:\home\node>> node traceDeprecation.js undefined
Output 2
C:\home\node>> node --trace-deprecation traceDeprecation.js true
Example 2
// process.traceDeprecation() Demo Example
// Importing the process module
const process = require('process');
// Initializing the traceDeprecation flag
process.traceDeprecation = false;
// Printing traceDeprecation
console.log(process.traceDeprecation);
// Initializing the traceDeprecation flag
process.traceDeprecation = true;
// Printing traceDeprecation
console.log(process.traceDeprecation);
Output 1
C:\home\node>> node traceDeprecation.js false true
Output 2
C:\home\node>> node --trace-deprecation traceDeprecation.js true true
Advertisements
