On this page

    P

    process.traceProcessWarnings

    History
    Attributes

    The process.traceProcessWarnings property indicates whether the --trace-warnings flag is set on the current Node.js process. This property allows programmatic control over the tracing of warnings, enabling or disabling stack traces for warnings at runtime.

    // Enable trace warnings
    process.traceProcessWarnings = true;
    
    // Emit a warning with a stack trace
    process.emitWarning('Warning with stack trace');
    
    // Disable trace warnings
    process.traceProcessWarnings = false;