zelin-bot / src /debug-mode.js
Z User
v5.8.5: Gemma 4, MC Wiki, MC Player, anti-hallucination, CPU optimizations
ee826ee
raw
history blame contribute delete
680 Bytes
// 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);
}