/**
 * Tiny logging helper used to replace silent `catch {}` blocks.
 *
 * Errors swallowed for control-flow reasons (best-effort persistence,
 * optional WebSocket cleanup, parsing untrusted JSON, etc.) should still
 * leave a debug trace so issues can be diagnosed without spamming users.
 */

export function logError(ctx: string, err: unknown): void {
    // Always emit at debug level so production logs stay quiet but the
    // information is reachable via DevTools verbose filtering.
    if (typeof console !== 'undefined' && console.debug) {
        console.debug(`[${ctx}]`, err);
    }
}
