@squasher-ai/pino ships two things in one package:
squasherTransport()— a Pino transport that forwards log events to Squasher. Drop-in for existing Pino setups.span()/log/recordMetric()— the same OpenTelemetry-compatible tracing primitives as@squasher-ai/edge, but for Node services.
Install
fetch + AsyncLocalStorage).
60-second example
src/server.ts
AsyncLocalStorage. Logs and metrics emitted inside a span auto-correlate.
The Pino transport
Forwards Pino log events to Squasher’s ingest endpoint with batching, retries, and level mapping.src/logger.ts
err object, Squasher extracts the error message, type, and stack trace automatically.
Transport options
The transport automatically splits multi-event request bodies at 1 MB.
batchSize and
flushIntervalMs still determine when buffered events are flushed.
Tracing primitives
Same API as@squasher-ai/edge. Quick version below — see the edge SDK page for the full reference.
initSquasher(config) — one-time startup
Call once at process startup. Sets up the global tracing client and auto-registers a beforeExit handler that flushes pending events.
span(name, fn) — one-line spans
status: "error" and re-thrown unchanged.
log.{debug, info, warn, error}(message, attrs?)
trace_id and span_id, traceId and spanId, or trace.id and span.id.
recordMetric(name, value, opts?)
Cross-process traces
Propagate via W3Ctraceparent to outbound HTTP:
parent: { traceId, spanId } to its own span() call.
Why both the transport AND tracing primitives?
- Pino transport is for logs. Drop-in for existing Pino setups, zero code changes.
span()/log.*/recordMetric()are for traces, metrics, and structured logs that need to correlate to spans.
Switch destinations
The SDK sends the Squasher ingest event format to the configured Squasher endpoint. Use the OpenTelemetry integration when you need a standard OTLP exporter or collector destination.API reference
Related guides
- Cloudflare Workers / Edge — same tracing API for Workers.
- Node.js SDK — error capture without Pino.
- Winston transport — same idea for Winston.
- OpenTelemetry — vendor-neutral OTLP setup.