Skip to main content
If you already use Winston, add the Squasher transport to ship logs and errors to your project without changing how you call logger.info() or logger.error().

Installation

Configuration

Create one SquasherTransport and add it to your Winston logger. Using winston.format.metadata() is recommended so structured fields land in Squasher as searchable metadata.
src/logger.ts
Call await squasherTransport.close() during shutdown so any queued events are flushed before the process exits.
The transport automatically splits multi-event request bodies at 1 MB so large log bursts use bounded requests without dropping the remaining buffered events.

Usage Example

src/app.ts
The transport sends events to POST /v1/ingest/{projectId} with tags.transport = "winston", so you can filter transport-originated logs in Squasher.

Advanced

Custom Levels

The transport maps Winston’s built-in levels to Squasher levels:
  • warnwarning
  • errorerror
  • fatalfatal
  • debug, verbose, and sillydebug
  • Any other custom level → info
If you use custom levels, normalize them before the transport sees them:
src/logger.ts

Metadata

When you use winston.format.metadata(), the transport forwards info.metadata as the event’s extra payload in Squasher.
If you do not use format.metadata(), extra Winston fields are still forwarded, but metadata() gives you the most predictable shape for nested context.

Agent handoff