index.js 495 Bytes
const MODULE_NAME = 'CRON.INDEX';
const logger = require('tektrans-logger');
const uniqid = require('uniqid');
const { CronJob } = require('cron');

const removeOldLogs = require('../logs/remove');

// eslint-disable-next-line no-unused-vars
const everyDay = new CronJob(
    '0 0 0 * * *',
    () => {
        const xid = uniqid();
        logger.verbose(`${MODULE_NAME} E5B4260C: run every day at 00:00`, { xid });
        removeOldLogs(xid);
    },
    null,
    true,
    'Asia/Jakarta',
);