Skip to content

Commit

Permalink
feat: allow to not log ping requests
Browse files Browse the repository at this point in the history
  • Loading branch information
johanfleury committed Jan 7, 2021
1 parent a461418 commit 282a0f3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ morgan.token('user-agent', (req: express.Request) => {
return req.get('user-agent')
})
app.use(morgan('combined', {
stream: { write: logger.info.bind(logger) }
stream: { write: logger.info.bind(logger) },
skip: function (req, res) {
return (req.path === '/api/v1/ping' && req.query.silent === 'true')
},
}))

// For body requests
Expand Down

0 comments on commit 282a0f3

Please sign in to comment.