mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-30 14:22:07 +03:00
caea330647
no issue Logging is now controlled by a logginrc.js file in the root of the project - and now we can just import @tryghost/logging everywhere
23 lines
716 B
JavaScript
23 lines
716 B
JavaScript
/**
|
|
* Minimal wrapper around our external lib
|
|
* Intended for passing any Ghost internals such as logging and config
|
|
*/
|
|
|
|
const JobManager = require('@tryghost/job-manager');
|
|
const logging = require('@tryghost/logging');
|
|
const sentry = require('../../../shared/sentry');
|
|
|
|
const errorHandler = (error, workerMeta) => {
|
|
logging.info(`Capturing error for worker during execution of job: ${workerMeta.name}`);
|
|
logging.error(error);
|
|
sentry.captureException(error);
|
|
};
|
|
|
|
const workerMessageHandler = ({name, message}) => {
|
|
logging.info(`Worker for job ${name} sent a message: ${message}`);
|
|
};
|
|
|
|
const jobManager = new JobManager({logging, errorHandler, workerMessageHandler});
|
|
|
|
module.exports = jobManager;
|