/**
 * Structured logger for Clawx.
 * Simple, no dependencies beyond chalk.
 */
import chalk from "chalk";
let currentLevel = "warn";
const LEVEL_PRIORITY = {
    debug: 0,
    info: 1,
    warn: 2,
    error: 3,
};
export function setLogLevel(level) {
    currentLevel = level;
}
function shouldLog(level) {
    return LEVEL_PRIORITY[level] >= LEVEL_PRIORITY[currentLevel];
}
function timestamp() {
    return new Date().toISOString().slice(11, 23);
}
export function debug(msg, ...args) {
    if (!shouldLog("debug"))
        return;
    console.error(chalk.gray(`[${timestamp()}] DBG ${msg}`), ...args);
}
export function info(msg, ...args) {
    if (!shouldLog("info"))
        return;
    console.error(chalk.blue(`[${timestamp()}] INF ${msg}`), ...args);
}
export function warn(msg, ...args) {
    if (!shouldLog("warn"))
        return;
    console.error(chalk.yellow(`[${timestamp()}] WRN ${msg}`), ...args);
}
export function error(msg, ...args) {
    if (!shouldLog("error"))
        return;
    console.error(chalk.red(`[${timestamp()}] ERR ${msg}`), ...args);
}
export const log = { debug, info, warn, error, setLogLevel };
//# sourceMappingURL=logger.js.map