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
|
|
@ -4,6 +4,7 @@ const makeDir = require('make-dir')
|
|||
const path = require('path')
|
||||
|
||||
const load = require('./options-loader')
|
||||
const logger = require('./logger')
|
||||
|
||||
// current path of lamassu-server project
|
||||
const currentBasePath = path.dirname(__dirname)
|
||||
|
|
@ -46,7 +47,7 @@ function updateOptionBasepath (result, optionName) {
|
|||
// update this option
|
||||
// if the value has changed
|
||||
if (!_.isEqual(currentPath, newPath)) {
|
||||
console.log(`Migrating option ${optionName} to new path ${newPath}`)
|
||||
logger.info(`Migrating option ${optionName} to new path ${newPath}`)
|
||||
result[optionName] = newPath
|
||||
}
|
||||
}
|
||||
|
|
@ -64,7 +65,7 @@ async function run () {
|
|||
|
||||
// get all the options
|
||||
// that ends with "Path" suffix
|
||||
console.log(`Detected lamassu-server basepath: ${currentBasePath}`)
|
||||
logger.info(`Detected lamassu-server basepath: ${currentBasePath}`)
|
||||
_.each(_.wrap(updateOptionBasepath, result),
|
||||
[
|
||||
'seedPath',
|
||||
|
|
@ -92,7 +93,7 @@ async function run () {
|
|||
// find new opts
|
||||
_.difference(_.keys(result), _.keys(currentOpts))
|
||||
), result)
|
||||
console.log('Updating options', newOpts)
|
||||
logger.info('Updating options', newOpts)
|
||||
|
||||
// store new lamassu.json file
|
||||
fs.writeFileSync(options.path, JSON.stringify(result, null, ' '))
|
||||
|
|
@ -105,7 +106,7 @@ async function run () {
|
|||
const path = _.attempt(() => makeDir.sync(v))
|
||||
|
||||
if (_.isError(path)) {
|
||||
console.error(`Error while creating folder ${v}`, path)
|
||||
logger.error(`while creating folder ${v}`, path)
|
||||
}
|
||||
}
|
||||
}, result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue