Structured logging (attempt 2) (#1234)

* Revert "Revert "feat(structured logging): implements structured logging for backend (#1217)" (#1227)"

This reverts commit 63e6581162.

* Use pino-http instead of express pino logger
* Use correct reference to knex and do not instantiate HttpLogger prematurely
* Adds missing dependency for pino to webhook-service
* Do not instantiate middleware when passed to express
* Refactor to move logging into shared
* Copy shared packages into dockerfiles
* Build shared workspace in docker build-stage for fileimport & webhook
This commit is contained in:
Iain Sproat
2022-12-05 14:49:52 +00:00
committed by GitHub
parent e807ae5fb1
commit 444d2ca7dd
110 changed files with 792 additions and 413 deletions
+4 -1
View File
@@ -1,4 +1,5 @@
/* istanbul ignore file */
const { logger } = require('@/logging/logging')
const prometheusClient = require('prom-client')
let metricErrorCount = null
@@ -13,7 +14,9 @@ module.exports = {
})
}
console.log(`Error when handling ${req.originalUrl} from ${req.ip}: ${err.message}`)
logger.error(
`Error when handling ${req.originalUrl} from ${req.ip}: ${err.message}`
)
let route = 'unknown'
if (req.route && req.route.path) route = req.route.path
metricErrorCount.labels(route).inc()