> ## 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.

# Logs

> Subscribe to Tron event log data with addLog() — filter by contract address, topic, and signature for efficient Tron event indexing.

#### `addLog(options)`

Get event logs emitted by some *or all* contracts in the network. `options` has the following structure:

```typescript theme={"system"}
{
  where?: {
    address?: string[]
    topic0?: string[]
    topic1?: string[]
    topic2?: string[]
    topic3?: string[]
  }
  include?: {
    transaction?: boolean
  }
  range?: {
    from: number
    to?: number
  }
}
```

**Data requests** are located in the `where` field:

* `address`: the set of addresses of contracts emitting the logs. Omit to subscribe to events from all contracts in the network.
* `topicN`: the set of values of topicN.

Omit the `where` field to subscribe to all logs network-wide.

**Related data** can be requested via the `include` field:

* `transaction = true`: will retrieve the parent transacton for each selected log.

The data will be added to the `.transactions` iterable within [block data](/en/sdk/squid-sdk/tron-indexing/tron-batch-processor/context-interfaces) and made available via the `.transaction` field of each log item.

Note that logs can also be requested by the other `TronBatchProcessor` methods as related data.

Selection of the exact fields to be retrieved for each log item and the optional parent transactions is done with the `setFields()` method documented on the [Field selection](/en/sdk/squid-sdk/tron-indexing/tron-batch-processor/field-selection) page.

#### Example

Request all `Transfer(address,address,uint256)` event logs emitted by the USDT smart contract, include parent txs.

```ts theme={"system"}
const USDT_ADDRESS = 'a614f803b6fd780986a42c78ec9c7f77e6ded13c'
const TRANSFER_TOPIC = 'ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'

processor.addLog({
  where: {
    address: [USDT_ADDRESS],
    topic0: [TRANSFER_TOPIC]
  },
  include: {
    transaction: true
  }
})
```
