bullmq
bullmq copied to clipboard
Is there a way to just add timestamps on job log entries ?
Is your feature request related to a problem? Please describe.
On my current project I use bullmq, to queue jobs needed to handle heavy cli
execution, it then requires me sometime to log directly into the job logs.
To be able for an admin, to do a better followup, We had to add the current date to the log as bellow:
const result = await this.executeSomeCommand(jobData);
if (!result.success) {
job.log(`[${new Date().toISOString()}]: ${result.message}`);
// ...
throw new Error(errorMessage);
}
and else where, I may be logging also some details like (job postponement):
await job.moveToDelayed(DELAY_IN_MILLIS, processingToken);
const retryMessage = `Job ${job.id} postponed until ${retryTimeFormatted}. Reason was ....`;
job.log(`[${new Date().toISOString()}]: ${retryMessage}`);
Describe the solution you'd like
Make job.log
consider the current time when saving a given log.