Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
app.log by default + log all signals in graceful shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
ildella committed Sep 18, 2023
1 parent 68b7309 commit ea1dbb7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions http/graceful-shutdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,13 @@ module.exports = ({app}) => {
// eslint-disable-next-line no-process-exit
return process.exit(0)
})
process.on('SIGTERM', event => {
app.log.warn('SIGTERM', event)
})
process.on('SIGQUIT', event => {
app.log.warn('SIGQUIT', event)
})
process.on('SIGKILL', event => {
app.log.warn('SIGKILL', event)
})
}
1 change: 1 addition & 0 deletions http/tracer-fastify-logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const {local} = require('../tracer')

module.exports = ({app, logLevel}) => {
const log = local({level: logLevel})
app.log = log
app.addHook('onRequest', (request, reply, done) => {
// eslint-disable-next-line fp/no-mutation
request.log = log
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "moar-js",
"version": "0.12.1",
"version": "0.12.2",
"description": "Simple JavaScript files I use across projects",
"author": {
"name": "Daniele Dellafiore"
Expand Down

0 comments on commit ea1dbb7

Please sign in to comment.