Signature
Returns
- A
BoundaryLogger<T>when eitherapiKey(orBOUNDARY_API_KEYenv var) orwriteis configured. nullotherwise — the dev-safe fallback. PassingnulltodefineContract({ logger })is a no-op.
BoundaryLoggerOptions
Default capture policy
category, issues, ruleFailures) and run metadata are always sent — they aren’t gated. See Capture policy.
Tuning by platform
See Node, Vercel & Lambda, Cloudflare Workers & Edge, and Browser for full per-runtime patterns.
BoundaryLogger<T>
The returned object:
- Implements every
ContractLogger<T>hook (assign it directly todefineContract({ logger })). flush(timeoutMs?)— drain the queue; logger stays active.shutdown(timeoutMs?)— drain, stop the timer, disable further sends. Idempotent.
Minimal example
Full example
Related types
BoundaryLogEvent— the wire formatCapturePolicy— the three buckets, plus the always-on fieldsRedactionOptions—fields/patterns/custom- Full SDK types: Types reference
See also
SDK Quickstart
Install and wire the logger
Shutdown
flush + shutdown + signal handling