import { INTERNAL_RANGO_DEBUG } from "../internal-debug.js";
let txCounter = 0;
let requestCounter = 0;
export function isBrowserDebugEnabled() {
    return INTERNAL_RANGO_DEBUG;
}
function nextId(prefix, counter) {
    return `${prefix}${counter.toString(36)}`;
}
export function startBrowserTransaction(operation) {
    txCounter += 1;
    requestCounter += 1;
    return {
        operation,
        txId: nextId("ctx-", txCounter),
        requestId: nextId("creq-", requestCounter),
    };
}
export function browserDebugLog(ctx, message, details) {
    if (!INTERNAL_RANGO_DEBUG)
        return;
    const prefix = `[Browser][req:${ctx.requestId}][tx:${ctx.operation}-${ctx.txId}]`;
    if (details) {
        console.log(`${prefix} ${message}`, details);
        return;
    }
    console.log(`${prefix} ${message}`);
}
//# sourceMappingURL=logging.js.map