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,6 +1,5 @@
|
||||
'use strict'
|
||||
const zlib = require('zlib')
|
||||
const debug = require('debug')
|
||||
const cors = require('cors')
|
||||
|
||||
const { validatePermissionsReadStream } = require('./authUtils')
|
||||
@@ -8,6 +7,7 @@ const { SpeckleObjectsStream } = require('./speckleObjectsStream')
|
||||
const { getObjectsStream } = require('../services/objects')
|
||||
|
||||
const { pipeline, PassThrough } = require('stream')
|
||||
const { logger } = require('@/logging/logging')
|
||||
|
||||
module.exports = (app) => {
|
||||
app.options('/api/getobjects/:streamId', cors())
|
||||
@@ -40,13 +40,13 @@ module.exports = (app) => {
|
||||
res,
|
||||
(err) => {
|
||||
if (err) {
|
||||
debug('speckle:error')(
|
||||
logger.error(
|
||||
`[User ${
|
||||
req.context.userId || '-'
|
||||
}] App error streaming objects from stream ${req.params.streamId}: ${err}`
|
||||
)
|
||||
} else {
|
||||
debug('speckle:info')(
|
||||
logger.info(
|
||||
`[User ${req.context.userId || '-'}] Streamed ${
|
||||
childrenList.length
|
||||
} objects from stream ${req.params.streamId} (size: ${
|
||||
@@ -73,7 +73,7 @@ module.exports = (app) => {
|
||||
})
|
||||
}
|
||||
} catch (ex) {
|
||||
debug('speckle:error')(
|
||||
logger.error(
|
||||
`[User ${req.context.userId || '-'}] DB Error streaming objects from stream ${
|
||||
req.params.streamId
|
||||
}: ${ex}`
|
||||
|
||||
Reference in New Issue
Block a user