/** * Production-safe logging utility * Automatically gates console.log based on environment * Always allows console.error for critical issues */ const isDev = process.env.NODE_ENV !== 'production' const debugEnabled = process.env.DEBUG_LOGS === 'true' export const logger = { /** * Debug logging - only in development or when DEBUG_LOGS=true */ log: (...args: any[]) => { if (isDev || debugEnabled) { console.log(...args) } }, /** * Error logging - always enabled (critical for production issues) */ error: (...args: any[]) => { console.error(...args) }, /** * Warning logging - always enabled (important for production monitoring) */ warn: (...args: any[]) => { console.warn(...args) }, /** * Info logging - only in development or when DEBUG_LOGS=true */ info: (...args: any[]) => { if (isDev || debugEnabled) { console.info(...args) } }, /** * Debug-specific logging - only when DEBUG_LOGS=true */ debug: (...args: any[]) => { if (debugEnabled) { console.log('[DEBUG]', ...args) } } }