mirror of
https://github.com/franjsco/trackmyd-bot
synced 2025-02-16 11:31:46 +01:00
add logger
This commit is contained in:
parent
cd262383f5
commit
4c60caad2e
32
logger.js
Normal file
32
logger.js
Normal 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;
|
Loading…
x
Reference in New Issue
Block a user