gfw-api/high-res

View on GitHub
app/src/logger.js

Summary

Maintainability
A
0 mins
Test Coverage
B
87%

const config = require('config');
const bunyan = require('bunyan');
/**
 * Create Logger
 */

module.exports = (() => {
    const streams = [{
        level: config.get('logger.level') || 'debug',
        stream: process.stdout
    }];
    if (config.get('logger.toFile')) {
        streams.push({
            level: config.get('logger.level') || 'debug',
            path: config.get('logger.dirLogFile')
        });
    }
    const logger = bunyan.createLogger({
        name: config.get('logger.name'),
        streams
    });
    return logger;

})();