chore: use logger for all important logs

This commit is contained in:
André Sá 2021-10-08 19:04:24 +01:00
parent 6f73606cfb
commit 21bdf5f60a
16 changed files with 51 additions and 39 deletions

View file

@ -23,6 +23,7 @@ const frontCameraBaseDir = _.get('frontCameraDir', options)
const operatorDataDir = _.get('operatorDataDir', options)
const sms = require('./sms')
const settingsLoader = require('./new-settings-loader')
const logger = require('./logger')
const TX_PASSTHROUGH_ERROR_CODES = ['operatorCancel']
@ -131,7 +132,7 @@ async function updateCustomer (id, data, userToken) {
Promise.all([getCustomerById(id), settingsLoader.loadLatest()])
.then(([customer, config]) => sms.getLookup(config, customer.phone))
.then(res => updateSubscriberData(id, res, userToken))
.catch(console.error)
.catch(logger.error)
}
invalidateCustomerNotifications(id, formattedData)
return getCustomerById(id)
@ -650,7 +651,7 @@ function updateIdCardData (patch, id) {
const imagesData = _.get('photos', patch)
return updatePhotos(imagesData, id, directory)
.then(newPatch => newPatch)
.catch(err => console.log('An error ocurred while saving the image ', err))
.catch(err => logger.error('while saving the image: ', err))
})
}