logger catagorizing libs

This commit is contained in:
Boki 2025-06-20 07:53:53 -04:00
parent 7a8e542ada
commit 4726a85cf3
12 changed files with 35 additions and 36 deletions

View file

@ -166,7 +166,7 @@ export async function processBatchJob(jobData: BatchJobData, queueName: string):
queueManager.getQueue(queueName);
const { payloadKey, batchIndex, totalBatches, itemCount, totalDelayHours } = jobData;
logger.debug('Processing batch job', {
logger.trace('Processing batch job', {
batchIndex,
totalBatches,
itemCount,
@ -187,7 +187,7 @@ export async function processBatchJob(jobData: BatchJobData, queueName: string):
const delayPerBatch = totalDelayMs / totalBatches; // Time allocated for each batch
const delayPerItem = delayPerBatch / items.length; // Distribute items evenly within batch window
logger.debug('Calculating job delays', {
logger.trace('Calculating job delays', {
batchIndex,
delayPerBatch: `${(delayPerBatch / 1000 / 60).toFixed(2)} minutes`,
delayPerItem: `${(delayPerItem / 1000).toFixed(2)} seconds`,

View file

@ -186,7 +186,7 @@ export class QueueManager {
enableMetrics: true,
});
this.caches.set(queueName, cacheProvider);
logger.debug('Cache created for queue', { queueName });
logger.trace('Cache created for queue', { queueName });
}
return this.caches.get(queueName)!;
}
@ -207,7 +207,7 @@ export class QueueManager {
private initializeBatchCacheSync(queueName: string): void {
// Just create the cache - it will connect automatically when first used
this.getCache(queueName);
logger.debug('Batch cache initialized synchronously for queue', { queueName });
logger.trace('Batch cache initialized synchronously for queue', { queueName });
}
/**

View file

@ -59,7 +59,7 @@ export class Queue {
this.startWorkers(config.workers, config.concurrency || 1);
}
logger.debug('Queue created', {
logger.trace('Queue created', {
queueName,
workers: config.workers || 0,
concurrency: config.concurrency || 1
@ -77,7 +77,7 @@ export class Queue {
* Add a single job to the queue
*/
async add(name: string, data: JobData, options: JobOptions = {}): Promise<Job> {
logger.debug('Adding job', { queueName: this.queueName, jobName: name });
logger.trace('Adding job', { queueName: this.queueName, jobName: name });
return await this.bullQueue.add(name, data, options);
}
@ -87,7 +87,7 @@ export class Queue {
async addBulk(
jobs: Array<{ name: string; data: JobData; opts?: JobOptions }>
): Promise<Job[]> {
logger.debug('Adding bulk jobs', {
logger.trace('Adding bulk jobs', {
queueName: this.queueName,
jobCount: jobs.length
});
@ -257,7 +257,7 @@ export class Queue {
// Setup worker event handlers
worker.on('completed', (job) => {
logger.debug('Job completed', {
logger.trace('Job completed', {
queueName: this.queueName,
jobId: job.id,
handler: job.data?.handler,
@ -299,7 +299,7 @@ export class Queue {
private async processJob(job: Job): Promise<unknown> {
const { handler, operation, payload }: JobData = job.data;
logger.debug('Processing job', {
logger.trace('Processing job', {
id: job.id,
handler,
operation,
@ -316,7 +316,7 @@ export class Queue {
const result = await jobHandler(payload);
logger.debug('Job completed successfully', {
logger.trace('Job completed successfully', {
id: job.id,
handler,
operation,