chore: proper error log format (#8105)

Fix some error log formatting to use `{ msg, err }` properly
This commit is contained in:
Elliot DeNolf
2024-09-06 22:48:59 -04:00
committed by GitHub
parent b27e42c484
commit 08fdbcacc0
5 changed files with 13 additions and 9 deletions

View File

@@ -23,7 +23,7 @@ const connectWithReconnect = async function ({
} else {
try {
result = await adapter.pool.connect()
} catch (err) {
} catch (ignore) {
setTimeout(() => {
payload.logger.info('Reconnecting to postgres')
void connectWithReconnect({ adapter, payload, reconnect: true })
@@ -38,7 +38,7 @@ const connectWithReconnect = async function ({
if (err.code === 'ECONNRESET') {
void connectWithReconnect({ adapter, payload, reconnect: true })
}
} catch (err) {
} catch (ignore) {
// swallow error
}
})
@@ -76,7 +76,7 @@ export const connect: Connect = async function connect(
}
}
} catch (err) {
this.payload.logger.error(`Error: cannot connect to Postgres. Details: ${err.message}`, err)
this.payload.logger.error({ err, msg: `Error: cannot connect to Postgres: ${err.message}` })
if (typeof this.rejectInitializing === 'function') {
this.rejectInitializing()
}