23 lines
606 B
JavaScript
23 lines
606 B
JavaScript
|
import bunyan from 'bunyan-lite'
|
||
|
import config from './config.mjs'
|
||
|
import * as defaults from './defaults.mjs'
|
||
|
|
||
|
|
||
|
// Clone the settings as we will be touching
|
||
|
// on them slightly.
|
||
|
let settings = defaults.default(config.get('bunyan'))
|
||
|
|
||
|
// Replace any instance of 'process.stdout' with the
|
||
|
// actual reference to the process.stdout.
|
||
|
for (let i = 0; i < settings.streams.length; i++) {
|
||
|
/* istanbul ignore else */
|
||
|
if (settings.streams[i].stream === 'process.stdout') {
|
||
|
settings.streams[i].stream = process.stdout
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Create our logger.
|
||
|
const log = bunyan.createLogger(settings)
|
||
|
|
||
|
export default log
|