mirror of
https://github.com/wassname/talk.git
synced 2026-07-19 11:28:50 +08:00
[CORL-540] Logging improvements (#2565)
* fix: enhanced errors around story creation * feat: enhanced child loggers * feat: logging enhancements
This commit is contained in:
committed by
Kim Gardner
parent
741739bc16
commit
64f102e6d4
@@ -21,7 +21,7 @@ export default class Task<T, U = any> {
|
||||
jobOptions = {},
|
||||
queue,
|
||||
}: TaskOptions<T, U>) {
|
||||
this.log = logger.child({ jobName });
|
||||
this.log = logger.child({ jobName }, true);
|
||||
this.queue = new Queue(jobName, queue);
|
||||
this.options = {
|
||||
jobName,
|
||||
@@ -70,7 +70,7 @@ export default class Task<T, U = any> {
|
||||
*/
|
||||
public process() {
|
||||
this.queue.process(async (job: Job<T>) => {
|
||||
const log = this.log.child({ jobID: job.id });
|
||||
const log = this.log.child({ jobID: job.id }, true);
|
||||
|
||||
log.trace("processing job from queue");
|
||||
|
||||
|
||||
@@ -38,10 +38,13 @@ export class MailerQueue {
|
||||
}
|
||||
|
||||
public async add({ template, tenantID, message: { to } }: MailerInput) {
|
||||
const log = logger.child({
|
||||
jobName: JOB_NAME,
|
||||
tenantID,
|
||||
});
|
||||
const log = logger.child(
|
||||
{
|
||||
jobName: JOB_NAME,
|
||||
tenantID,
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
// All email templates require the tenant in order to insert the footer, so
|
||||
// load it from the tenant cache here.
|
||||
|
||||
@@ -206,11 +206,14 @@ export const createJobProcessor = (options: MailProcessorOptions) => {
|
||||
// Pull the data out of the validated model.
|
||||
const { tenantID } = data;
|
||||
|
||||
const log = logger.child({
|
||||
jobID: job.id,
|
||||
jobName: JOB_NAME,
|
||||
tenantID,
|
||||
});
|
||||
const log = logger.child(
|
||||
{
|
||||
jobID: job.id,
|
||||
jobName: JOB_NAME,
|
||||
tenantID,
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
// Get the referenced tenant so we know who to send it from.
|
||||
const tenant = await tenantCache.retrieveByID(tenantID);
|
||||
|
||||
@@ -70,11 +70,14 @@ export const createJobProcessor = ({
|
||||
const { tenantID, input } = job.data;
|
||||
|
||||
// Create a new logger to handle logging for this job.
|
||||
const log = logger.child({
|
||||
jobID: job.id,
|
||||
jobName: JOB_NAME,
|
||||
tenantID,
|
||||
});
|
||||
const log = logger.child(
|
||||
{
|
||||
jobID: job.id,
|
||||
jobName: JOB_NAME,
|
||||
tenantID,
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
log.debug("starting to handle a notify operation");
|
||||
|
||||
|
||||
@@ -24,13 +24,16 @@ const createJobProcessor = ({ mongo }: ScrapeProcessorOptions) => async (
|
||||
// Pull out the job data.
|
||||
const { storyID, storyURL, tenantID } = job.data;
|
||||
|
||||
const log = logger.child({
|
||||
jobID: job.id,
|
||||
jobName: JOB_NAME,
|
||||
storyID,
|
||||
storyURL,
|
||||
tenantID,
|
||||
});
|
||||
const log = logger.child(
|
||||
{
|
||||
jobID: job.id,
|
||||
jobName: JOB_NAME,
|
||||
storyID,
|
||||
storyURL,
|
||||
tenantID,
|
||||
},
|
||||
true
|
||||
);
|
||||
|
||||
// Mark the start time.
|
||||
const startTime = now();
|
||||
|
||||
Reference in New Issue
Block a user