egg-logrotator
Version:
logrotator for egg
23 lines (15 loc) • 422 B
JavaScript
;
const HourRotator = require('../lib/hour_rotator');
module.exports = app => {
const rotator = new HourRotator({ app });
return {
schedule: {
type: 'worker', // only one worker run this task
cron: '1 * * * *', // run every hour at 01
disable: (app.config.logrotator.filesRotateByHour || []).length === 0,
},
async task() {
await rotator.rotate();
},
};
};