j3k0 / ganomede-admin

Ganomede administration interface
0 stars 0 forks source link

adjust the logging to use bunyan, and fix eslint no-console #92

Closed HusseinTaha closed 3 years ago

HusseinTaha commented 3 years ago

I added the code for the bunyan, and adjust the log.js file to reuse bunyan isntead of the console.log and remove the eslint no-console.

const config = require('../config');
let bunyan = require('bunyan');
let log = bunyan.createLogger({name: config.branding.title}); 

const logger = function(){
    let a = arguments;
    log.debug.apply(log, a);
};

logger.debug = log.debug.bind(log);
logger.info = log.info.bind(log);
logger.warn = log.warn.bind(log);
logger.error = log.error.bind(log);

module.exports = logger;
j3k0 commented 3 years ago

Excellent! I didn't even realize that server/log.js wasn't using bunyan. All other services do, so I just assume it was doing the same.

Thanks for the fix! It all looks good.