"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.logger = exports.Logger = void 0;
class Logger {
    enabled;
    constructor(enabled = false) {
        this.enabled = enabled;
    }
    setEnabled(val) {
        this.enabled = val;
    }
    error(msg, err) {
        if (!this.enabled)
            return;
        const errMsg = err instanceof Error ? err.message : String(err || '');
        process.stderr.write(`[CELL ERROR] ${msg} ${errMsg}\n`.slice(0, 500));
    }
    warn(msg) {
        if (!this.enabled)
            return;
        process.stderr.write(`[CELL WARN] ${msg}\n`.slice(0, 300));
    }
}
exports.Logger = Logger;
exports.logger = new Logger(!!process.env.CELL_DEBUG);
//# sourceMappingURL=logger.js.map