"use strict";
// Tiny structured logger. systemd captures stdout/stderr to journal, so we
// just print — no file rotation needed. Keep messages single-line so
// `journalctl -u appmint-hub -f` stays readable.
Object.defineProperty(exports, "__esModule", { value: true });
exports.log = void 0;
exports.setLogLevel = setLogLevel;
const ORDER = { debug: 0, info: 1, warn: 2, error: 3 };
let threshold = ORDER.info;
function setLogLevel(l) {
    if (l && l in ORDER)
        threshold = ORDER[l];
}
function emit(level, msg, extra) {
    if (ORDER[level] < threshold)
        return;
    const ts = new Date().toISOString();
    const line = extra
        ? `${ts} ${level.toUpperCase()} ${msg} ${JSON.stringify(extra)}`
        : `${ts} ${level.toUpperCase()} ${msg}`;
    if (level === 'error' || level === 'warn')
        console.error(line);
    else
        console.log(line);
}
exports.log = {
    debug: (msg, extra) => emit('debug', msg, extra),
    info: (msg, extra) => emit('info', msg, extra),
    warn: (msg, extra) => emit('warn', msg, extra),
    error: (msg, extra) => emit('error', msg, extra),
};
//# sourceMappingURL=log.js.map