Skip to content

Commit f83063f

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

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

doc/api/process.md

+21
Original file line numberDiff line numberDiff line change
@@ -3827,6 +3827,27 @@ 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.10.0
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+
```mjs
3841+
// Enable trace warnings
3842+
process.traceProcessWarnings = true;
3843+
3844+
// Emit a warning with a stack trace
3845+
process.emitWarning('Warning with stack trace');
3846+
3847+
// Disable trace warnings
3848+
process.traceProcessWarnings = false;
3849+
```
3850+
38303851
## `process.umask()`
38313852
38323853
<!-- YAML

0 commit comments

Comments
 (0)