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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user