feat(logging): Exclude /status route from logging

This patch should reduce the logging noise a lot, by removing the
`/status` route from logging unless hedgedoc is running in debug mode or
the route throws an error code.

This is achieved by providing a "skip"-function to the morgan logging
provider.

Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
This commit is contained in:
Sheogorath 2021-08-15 20:50:18 +02:00
parent 6c17823da1
commit add5d998c0
No known key found for this signature in database
GPG key ID: C9B1C80737B9CE18
2 changed files with 7 additions and 0 deletions

6
app.js
View file

@ -65,6 +65,12 @@ if (!config.useSSL && config.protocolUseSSL) {
// logger
app.use(morgan('combined', {
skip: function(req, res) {
// skip logging if specified
// unless the app is running in debug mode
// or throws an error
return req.skipLogging && config.loglevel !== "debug" && res.statusCode < 400
},
stream: logger.stream
}))