2019-02-21 14:54:06 +01:00
|
|
|
/* eslint-disable no-console */
|
|
|
|
const bunyan = require('bunyan');
|
2020-05-12 23:40:49 +02:00
|
|
|
const config = require('../config.json');
|
2019-02-21 14:54:06 +01:00
|
|
|
|
|
|
|
const log = bunyan.createLogger({
|
|
|
|
name: config.app.name,
|
|
|
|
streams: [{
|
|
|
|
level: 'info',
|
|
|
|
path: config.logger.infoLogging.filename,
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
|
|
|
|
function logError(msg) {
|
|
|
|
log.error(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
function logInfo(msg) {
|
|
|
|
log.info(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
function logFatal(msg) {
|
|
|
|
log.fatal(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
function logConsole(msg) {
|
|
|
|
console.log(`(${config.app.name}): ${msg}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports.logError = logError;
|
|
|
|
module.exports.logInfo = logInfo;
|
|
|
|
module.exports.logFatal = logFatal;
|
|
|
|
module.exports.logConsole = logConsole;
|