Skip to main content
@squasher-ai/pino is a Pino transport. It sends your Pino logs to Squasher, and log lines at error level and above become issues. This page is tested with version 0.4.1 and Pino 10 on Node.js 26.

Install the transport

Add your ingest key and project ID to the environment of your service:
.env
To get both values, see Create an ingest key.

Add the transport to your logger

Add @squasher-ai/pino as a transport target. This example also keeps the logs on standard output:
src/logger.ts
level on the target sets the lowest level that goes to Squasher. Pino runs the transport in a worker thread, so pass only values that can be copied: strings, numbers, and plain objects. Set environment to production in production: automatic AI triage runs only on issues from that environment.

Log errors

Pass the error in the err field:
src/checkout.ts
The transport sends the event as checkout failed: <error message>, with the error type and the stack trace. Other fields, such as orderId, go into the event’s extra data. pid and hostname become tags.

Send a test error

Run this once with the same environment variables:
scripts/squasher-test.ts
The transport sends events in batches, every 5 seconds or when 25 events are queued. Pino sends the rest when the process exits normally. Then select Issues in the sidebar of your project. If the error does not appear, see Troubleshooting.

Add spans, logs, and metrics

The package also exports the tracing helpers of the Cloudflare Workers SDK for Node.js. Call initSquasher once when the process starts:
src/index.ts
span sends one event when its function ends. When the function throws, the event has the error message and error level, and span throws the error again. The client sends events every 5 seconds and when the process exits normally. These helpers do not use the Pino transport or its options.

Options

These are the options of the transport target. Pino warn becomes warning, and trace becomes debug. sampling treats events at warning level and above as errors, so errorRate applies to them.

Limits

  • After an HTTP 401 response, the transport logs Invalid API key and stops sending for 60 seconds.
  • After an HTTP 429 response, the transport waits once and then drops the batch.
  • If the process ends with process.exit() or a crash, Pino can lose the events that are still in the worker thread.
  • Stack traces point at the files that Node.js runs. If you bundle your code, upload source maps for the release so the issue page shows the original files.

Give the setup to a coding agent

Copy this prompt into your coding agent to install the transport the same way:

Next steps

Node.js SDK

Capture uncaught exceptions and framework errors.

Design queryable logs

Choose log fields that are easy to search.

Winston transport

Send Winston logs instead.

Read AI triage

Learn what the triage summary tells you.