//#region src/logger.ts
function fmt(level, msg, fields) {
	if (!fields || Object.keys(fields).length === 0) return `[agentmemory] ${level} ${msg}`;
	try {
		return `[agentmemory] ${level} ${msg} ${JSON.stringify(fields)}`;
	} catch {
		return `[agentmemory] ${level} ${msg}`;
	}
}
function emit(level, msg, fields) {
	try {
		process.stderr.write(fmt(level, msg, fields) + "\n");
	} catch {}
}
const logger = {
	info(msg, fields) {
		emit("info", msg, fields);
	},
	warn(msg, fields) {
		emit("warn", msg, fields);
	},
	error(msg, fields) {
		emit("error", msg, fields);
	}
};
let bootVerbose = process.env["AGENTMEMORY_VERBOSE"] === "1" || process.env["AGENTMEMORY_VERBOSE"] === "true";
const bootBuffer = [];
function setBootVerbose(enabled) {
	bootVerbose = enabled;
}
function bootLog(msg) {
	if (bootVerbose) {
		try {
			process.stderr.write(`[agentmemory] ${msg}\n`);
		} catch {}
		return;
	}
	if (bootBuffer.length < 500) bootBuffer.push(msg);
}
//#endregion
export { logger as n, setBootVerbose as r, bootLog as t };

//# sourceMappingURL=logger-yHTcEBAI.mjs.map