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

View file

@ -14,6 +14,7 @@ const statusRouter = module.exports = Router()
// get status
statusRouter.get('/status', function (req, res, next) {
req.skipLogging = true
realtime.getStatus(function (data) {
res.set({
'Cache-Control': 'private', // only cache by client