chore: use logger for all important logs
This commit is contained in:
parent
6f73606cfb
commit
21bdf5f60a
16 changed files with 51 additions and 39 deletions
|
|
@ -47,7 +47,7 @@ logger.info('Version: %s', version)
|
|||
const hostname = options.hostname
|
||||
|
||||
if (!hostname) {
|
||||
console.error('Error: no hostname specified.')
|
||||
logger.error('no hostname specified.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ module.exports = {run}
|
|||
|
||||
function dbNotify () {
|
||||
return got.post('http://localhost:3030/dbChange')
|
||||
.catch(e => console.error('Error: lamassu-server not responding'))
|
||||
.catch(e => logger.error('lamassu-server not responding'))
|
||||
}
|
||||
|
||||
const skip = (req, res) => req.path === '/api/status/' && res.statusCode === 200
|
||||
|
|
@ -216,7 +216,7 @@ app.patch('/api/customer/:id', (req, res, next) => {
|
|||
})
|
||||
|
||||
app.use((err, req, res, next) => {
|
||||
console.error(err)
|
||||
logger.error(err)
|
||||
|
||||
return res.status(500).send(err.message)
|
||||
})
|
||||
|
|
@ -282,7 +282,7 @@ function authenticate (req, res, next) {
|
|||
}
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
console.error(err.stack)
|
||||
logger.error(err.stack)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
|
|
@ -336,6 +336,6 @@ function run () {
|
|||
const serverLog = `lamassu-admin-server listening on port ${serverPort}`
|
||||
const supportLog = `lamassu-support-server listening on port ${supportPort}`
|
||||
|
||||
webServer.listen(serverPort, () => console.log(serverLog))
|
||||
supportServer.run(supportPort).then(console.log(supportLog))
|
||||
webServer.listen(serverPort, () => logger.info(serverLog))
|
||||
supportServer.run(supportPort).then(logger.info(supportLog))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue