2020-04-07 10:36:11 +00:00
|
|
|
import bunyan from 'bunyan-lite'
|
2020-04-06 22:47:58 +00:00
|
|
|
import defaults from './defaults.mjs'
|
|
|
|
import config from './config.mjs'
|
2016-04-10 08:37:05 +00:00
|
|
|
|
|
|
|
// Clone the settings as we will be touching
|
|
|
|
// on them slightly.
|
2020-04-06 22:47:58 +00:00
|
|
|
let settings = defaults(config.get('bunyan'), null)
|
2016-04-10 08:37:05 +00:00
|
|
|
|
|
|
|
// Replace any instance of 'process.stdout' with the
|
|
|
|
// actual reference to the process.stdout.
|
|
|
|
for (let i = 0; i < settings.streams.length; i++) {
|
|
|
|
if (settings.streams[i].stream === 'process.stdout') {
|
|
|
|
settings.streams[i].stream = process.stdout
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create our logger.
|
|
|
|
const logger = bunyan.createLogger(settings)
|
|
|
|
|
|
|
|
export default logger
|