Improve logging system with environment variable control

- Change default log level to 'warn' for production
- Add PAYLOAD_AUTOMATION_LOG_LEVEL environment variable
- Remove all verbose config-phase logs
- Add documentation for log level control
This commit is contained in:
2025-09-09 13:52:06 +02:00
parent e138176878
commit 73c8c20c4b
4 changed files with 55 additions and 21 deletions

View File

@@ -7,7 +7,6 @@ export function initWebhookEndpoint(config: Config, webhookPrefix = 'webhook'):
const logger = getConfigLogger()
// Ensure the prefix starts with a slash
const normalizedPrefix = webhookPrefix.startsWith('/') ? webhookPrefix : `/${webhookPrefix}`
logger.debug(`Adding webhook endpoint: ${normalizedPrefix}`)
// Define webhook endpoint
const webhookEndpoint = {
@@ -170,9 +169,5 @@ export function initWebhookEndpoint(config: Config, webhookPrefix = 'webhook'):
if (!existingEndpoint) {
// Combine existing endpoints with the webhook endpoint
config.endpoints = [...(config.endpoints || []), webhookEndpoint]
logger.debug(`Webhook endpoint added at path: ${webhookEndpoint.path}`)
logger.debug('Webhook endpoint added')
} else {
logger.debug(`Webhook endpoint already exists at path: ${webhookEndpoint.path}`)
}
}