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:
@@ -8,6 +8,7 @@ const { fetch } = require('undici')
|
||||
const { init } = require(`@/app`)
|
||||
const request = require('supertest')
|
||||
const { exit } = require('yargs')
|
||||
const { logger } = require('@/logging/logging')
|
||||
|
||||
const main = async () => {
|
||||
const testStream = {
|
||||
@@ -53,7 +54,7 @@ const main = async () => {
|
||||
.set('Content-type', 'multipart/form-data')
|
||||
.attach('batch1', Buffer.from(JSON.stringify(objBatch), 'utf8'))
|
||||
|
||||
console.log(uploadRes.status)
|
||||
logger.info(uploadRes.status)
|
||||
const objectIds = objBatch.map((obj) => obj.id)
|
||||
|
||||
const res = await fetch(`http://localhost:3000/api/getobjects/${testStream.id}`, {
|
||||
@@ -66,8 +67,8 @@ const main = async () => {
|
||||
body: JSON.stringify({ objects: JSON.stringify(objectIds) })
|
||||
})
|
||||
const data = await res.body.getReader().read()
|
||||
console.log(data)
|
||||
logger.info(data)
|
||||
exit(0)
|
||||
}
|
||||
|
||||
main().then(console.log('created')).catch(console.log('failed'))
|
||||
main().then(logger.info('created')).catch(logger.error('failed'))
|
||||
|
||||
Reference in New Issue
Block a user