1
0
mirror of https://github.com/franjsco/trackmyd-bot synced 2025-02-16 11:31:46 +01:00

add logger

This commit is contained in:
Francesco Esposito 2019-02-21 14:54:06 +01:00
parent cd262383f5
commit 4c60caad2e

32
logger.js Normal file
View File

@ -0,0 +1,32 @@
/* eslint-disable no-console */
const bunyan = require('bunyan');
const config = require('./config.json');
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;