summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Trujillo <joaqt23@gmail.com>2022-01-21 18:53:43 -0500
committerGitHub <noreply@github.com>2022-01-21 23:53:43 +0000
commit806c7c13f3e0a516a9b361033e5c6d4814a9cba2 (patch)
tree79d4dafd578d30add6796a2d57241f8d50bcd526
parent82756836b25cd08bc942a5398be7caefee95229f (diff)
downloadnode-new-806c7c13f3e0a516a9b361033e5c6d4814a9cba2.tar.gz
doc: add note for handling signal events in trace events
Refs: https://github.com/nodejs/node/issues/14802 PR-URL: https://github.com/nodejs/node/pull/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>
-rw-r--r--doc/api/tracing.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/api/tracing.md b/doc/api/tracing.md
index d0b5ac4250..df76d985f7 100644
--- a/doc/api/tracing.md
+++ b/doc/api/tracing.md
@@ -80,6 +80,17 @@ string that supports `${rotation}` and `${pid}`:
node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js
```
+To guarantee that the log file is properly generated after signal events like
+`SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers
+in your code, such as:
+
+```js
+process.on('SIGINT', function onSigint() {
+ console.info('Received SIGINT.');
+ process.exit(130); // Or applicable exit code depending on OS and signal
+});
+```
+
The tracing system uses the same time source
as the one used by `process.hrtime()`.
However the trace-event timestamps are expressed in microseconds,