zebb-logger
Version:
LoggerSDK for Microservices with multiple adapters eg: Pino, Winston, Bunyan with support for [Mapped Diagnostics Context](http://logback.qos.ch/manual/mdc.html).
32 lines (24 loc) • 717 B
JavaScript
// eslint-disable-next-line
const delay = require('lodash.delay');
const { Logger } = require('../logger');
class Job {
constructor(job) {
this.job = job;
this.logger = new Logger(__filename, { job_id: job.id });
}
updateBalance() {
this.logger.debug(`Updating balance for user ${this.job.user_id}`);
}
connectToBank() {
this.logger.debug(`Connecting to bank gateway: ${this.job.gateway} ${this.job.transaction_id}`);
delay(this.updateBalance.bind(this), 300);
}
processPayment() {
this.logger.debug(`Processing payment for ${this.job.user_id}`);
delay(this.connectToBank.bind(this), 500);
}
processJob() {
this.processPayment();
}
}
module.exports = Job;