This repository has been archived on 2025-10-29. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
gekko/plugins/eventLogger.js
T
2021-06-06 20:25:14 +02:00

20 lines
522 B
JavaScript

const log = require('../core/log');
const _ = require('lodash');
const subscriptions = require('../subscriptions');
const config = require('../core/util').getConfig().eventLogger;
const EventLogger = function() {}
_.each(subscriptions, sub => {
if(config.whitelist && !config.whitelist.includes(sub.event)) {
return;
}
EventLogger.prototype[sub.handler] = (event, next) => {
log.info(`\t\t\t\t[EVENT ${sub.event}]\n`, event);
if(_.isFunction(next))
next();
}
});
module.exports = EventLogger;