Skip to content

Commit 1d1c74b

Browse files
doc: add documentation for process.traceProcessWarnings
resolves #53514
1 parent 2e5fc8a commit 1d1c74b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

doc/api/process.md

+23
Original file line numberDiff line numberDiff line change
@@ -3827,6 +3827,29 @@ documentation for the [`'warning'` event][process_warning] and the
38273827
[`emitWarning()` method][process_emit_warning] for more information about this
38283828
flag's behavior.
38293829
3830+
## `process.traceProcessWarnings`
3831+
3832+
<!-- YAML
3833+
added: v6.x
3834+
-->
3835+
3836+
* {boolean}
3837+
3838+
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.
3839+
3840+
Setting this property to `true` enables the tracing of warnings, akin to launching the process with the `--trace-warnings` command-line option. Conversely, setting it to `false` disables the tracing.
3841+
3842+
```mjs
3843+
// Enable trace warnings
3844+
process.traceProcessWarnings = true;
3845+
3846+
// Emit a warning with a stack trace
3847+
process.emitWarning('Warning with stack trace');
3848+
3849+
// Disable trace warnings
3850+
process.traceProcessWarnings = false;
3851+
```
3852+
38303853
## `process.umask()`
38313854
38323855
<!-- YAML

0 commit comments

Comments
 (0)