Skip to content

Commit 09763a2

Browse files
thedullBethGriggs
authored andcommitted
doc: add note for handling signal events in trace events
Refs: #14802 PR-URL: #41438 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Adrian Estrada <edsadr@gmail.com> Reviewed-By: Mary Marchini <oss@mmarchini.me> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
1 parent 3b45c05 commit 09763a2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

doc/api/tracing.md

+11
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,17 @@ string that supports `${rotation}` and `${pid}`:
8080
node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
8181
```
8282

83+
To guarantee that the log file is properly generated after signal events like
84+
`SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers
85+
in your code, such as:
86+
87+
```js
88+
process.on('SIGINT', function onSigint() {
89+
console.info('Received SIGINT.');
90+
process.exit(130); // Or applicable exit code depending on OS and signal
91+
});
92+
```
93+
8394
The tracing system uses the same time source
8495
as the one used by `process.hrtime()`.
8596
However the trace-event timestamps are expressed in microseconds,

0 commit comments

Comments
 (0)