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 @@
|
||||
const knex = require('@/db/knex')
|
||||
const { logger } = require('@/logging/logging')
|
||||
const roles = require('@/modules/core/roles.js')
|
||||
|
||||
const Users = () => knex('users')
|
||||
@@ -24,10 +25,10 @@ const migrateColumnValue = async (tableName, columnName, oldUser, newUser) => {
|
||||
const query = knex(tableName)
|
||||
.where({ [columnName]: oldUser.id })
|
||||
.update({ [columnName]: newUser.id })
|
||||
console.log(`${query}`)
|
||||
logger.info(`${query}`)
|
||||
await query
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
logger.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +107,7 @@ const getDuplicateUsers = async () => {
|
||||
|
||||
const runMigrations = async () => {
|
||||
const duplicateUsers = await getDuplicateUsers()
|
||||
console.log(duplicateUsers)
|
||||
logger.info(duplicateUsers)
|
||||
await Promise.all(
|
||||
duplicateUsers.map(async (userDouble) => {
|
||||
const migrations = createMigrations(userDouble)
|
||||
@@ -125,7 +126,7 @@ const runMigrations = async () => {
|
||||
// await createData()
|
||||
await runMigrations()
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
logger.error(err)
|
||||
} finally {
|
||||
process.exit()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user