import { config } from '../config.js'; const LEVELS = { debug: 10, info: 20, warn: 30, error: 40 }; const threshold = LEVELS[config.logLevel] ?? LEVELS.info; const write = (level, stream, args) => { if (LEVELS[level] < threshold) return; stream(`[${new Date().toISOString()}] ${level.toUpperCase()}`, ...args); }; export const logger = { debug: (...args) => write('debug', console.debug, args), info: (...args) => write('info', console.info, args), warn: (...args) => write('warn', console.warn, args), error: (...args) => write('error', console.error, args), };