mirror of
https://github.com/xtr-dev/payload-mailing.git
synced 2025-12-10 08:13:23 +00:00
Add configurable logger with PAYLOAD_MAILING_LOG_LEVEL support
- Created centralized logger utility using Payload's built-in logger system - Added PAYLOAD_MAILING_LOG_LEVEL environment variable for log level configuration - Replaced all console.log/error/warn calls with structured logger - Added debug logging for immediate processing flow to help troubleshoot issues - Improved logging context with specific prefixes (IMMEDIATE, PROCESSOR, JOB_SCHEDULER, etc.) - Bumped version to 0.4.10 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { PayloadRequest, Payload } from 'payload'
|
||||
import { processAllEmails } from '../utils/emailProcessor.js'
|
||||
import { createContextLogger } from '../utils/logger.js'
|
||||
|
||||
/**
|
||||
* Data passed to the process emails task
|
||||
@@ -67,7 +68,8 @@ export const scheduleEmailsJob = async (
|
||||
delay?: number
|
||||
) => {
|
||||
if (!payload.jobs) {
|
||||
console.warn('PayloadCMS jobs not configured - emails will not be processed automatically')
|
||||
const logger = createContextLogger(payload, 'SCHEDULER')
|
||||
logger.warn('PayloadCMS jobs not configured - emails will not be processed automatically')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -79,6 +81,7 @@ export const scheduleEmailsJob = async (
|
||||
waitUntil: delay ? new Date(Date.now() + delay) : undefined,
|
||||
} as any)
|
||||
} catch (error) {
|
||||
console.error('Failed to schedule email processing job:', error)
|
||||
const logger = createContextLogger(payload, 'SCHEDULER')
|
||||
logger.error('Failed to schedule email processing job:', error)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user