Skip to main content

Signature

Returns

  • A BoundaryLogger<T> when either apiKey (or BOUNDARY_API_KEY env var) or write is configured.
  • null otherwise — the dev-safe fallback. Passing null to defineContract({ logger }) is a no-op.

BoundaryLoggerOptions

Default capture policy

Three optional buckets. Raw LLM inputs and outputs are off by default; repair messages are on so the dashboard can show how the model recovered. Failure attribution (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 to defineContract({ logger })).
  • flush(timeoutMs?) — drain the queue; logger stays active.
  • shutdown(timeoutMs?) — drain, stop the timer, disable further sends. Idempotent.
See Shutdown for timeout semantics and per-platform recipes.

Minimal example

Full example

See also

SDK Quickstart

Install and wire the logger

Shutdown

flush + shutdown + signal handling