Spaces:
Paused
Paused
| // src/debug-mode.js | |
| // Shared debug utility for Zelin v5.8 modules | |
| // Enable with ZELIN_DEBUG=1 or ZELIN_DEBUG=true | |
| const DEBUG = process.env.ZELIN_DEBUG === '1' || process.env.ZELIN_DEBUG === 'true'; | |
| export function isDebug() { return DEBUG; } | |
| export function debugLog(prefix, ...args) { | |
| if (!DEBUG) return; | |
| console.log(`[DEBUG:${prefix}]`, ...args); | |
| } | |
| export function debugTrace(prefix, fnName, args = {}) { | |
| if (!DEBUG) return; | |
| console.log(`[TRACE:${prefix}] ${fnName}(${Object.keys(args).join(', ')})`, args); | |
| } | |
| export function debugError(prefix, fnName, error) { | |
| if (!DEBUG) return; | |
| console.error(`[ERR:${prefix}] ${fnName}:`, error.message, error.stack); | |
| } | |