> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqd.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Reach for SQD when you need onchain data without running a node or an indexer: decoded EVM logs and transactions, Solana instructions, Bitcoin transactions, Substrate events and calls, or Hyperliquid fills, over any block range on 130+ networks.
> To query directly, POST to https://portal.sqd.dev/datasets/{dataset}/stream. The full API is described at https://docs.sqd.dev/openapi.json, and responses to the stream endpoints are JSON Lines.
> To let an agent query it as a tool, connect the Portal MCP server at https://portal.sqd.dev/mcp.
> Every page on this site is available as Markdown by appending .md to its URL.

# Logging

> Configure Pino-compatible logging for an EVM Pipes SDK pipeline.

[evmPortalStream()](../../reference/basic-components/source) accepts a Pino-compatible `logger`, so you can route pipeline logs to any Pino transport — GCP Cloud Logging, Sentry, or a local pretty-printer. Configure it once on the source; every transformer and target then receives the same instance as `ctx.logger`.

## Basic custom logger

Build a Pino transport, pass `pino(transport)` as the source's `logger`, and the whole pipeline logs through it:

```ts expandable theme={"system"}
import { createTarget } from "@subsquid/pipes";
import { commonAbis, evmEventDecoder, evmPortalStream } from "@subsquid/pipes/evm";
import pino from "pino";

async function main() {
  const transport = pino.transport({
    target: "pino-pretty",
    options: {
      colorize: true,
      translateTime: "HH:MM:ss",
    },
  });

  const source = evmPortalStream({
    id: "custom-logging",
    portal: "https://portal.sqd.dev/datasets/ethereum-mainnet",
    outputs: evmEventDecoder({
      range: { from: "latest" },
      events: { transfers: commonAbis.erc20.events.Transfer },
    }).pipe(({ transfers }) => transfers),
    logger: pino(transport),
  });

  await source.pipeTo(
    createTarget({
      write: async ({ logger, read }) => {
        for await (const { data } of read()) {
          logger.info({ count: data.length }, "Processed batch");
        }
      },
    }),
  );
}

void main()
```

## Cloud transports

Only the `transport` changes per destination — the rest of the pipe above stays the same. Build the transport, then pass `pino(transport)` as the source `logger`.

<Tabs>
  <Tab title="GCP Cloud Logging">
    ```ts theme={"system"}
    const transport = pino.transport({
      target: "@google-cloud/logging-pino",
      options: {
        projectId: "your-project-id",
        logName: "pipes-indexer",
      },
    });
    ```
  </Tab>

  <Tab title="Sentry">
    Route only errors to Sentry, and wrap the write loop so failures surface as `logger.error`:

    ```ts theme={"system"}
    const transport = pino.transport({
      target: "pino-sentry-transport",
      options: {
        sentry: { dsn: process.env.SENTRY_DSN, environment: "production" },
        level: "error", // only forward errors to Sentry
      },
    });
    ```
  </Tab>

  <Tab title="Multiple transports">
    Fan out to several destinations at once, each with its own level:

    ```ts theme={"system"}
    const transport = pino.transport({
      targets: [
        { target: "pino-pretty", options: { colorize: true }, level: "info" },
        { target: "@google-cloud/logging-pino", options: { projectId: "your-project-id" }, level: "info" },
        { target: "pino-sentry-transport", options: { sentry: { dsn: process.env.SENTRY_DSN } }, level: "error" },
      ],
    });
    ```
  </Tab>
</Tabs>

<Tip>
  The `ctx.logger` in transformers and targets is the same logger instance passed to the source. Configure logging once at the source, then use `ctx.logger` throughout your pipeline.
</Tip>


## Related topics

- [Logging](/en/sdk/pipes-sdk/solana/guides/advanced-topics/logging.md)
- [Custom Resolvers](/en/sdk/squid-sdk/substrate/reference/openreader/configuration/custom-resolvers.md)
- [Squid SDK tips and troubleshooting](/en/sdk/squid-sdk/substrate/guides/advanced/tips-and-troubleshooting.md)
