Skip to content

EVM-40: EvmConsoleOutputFormatter #156

@Puneethkumarck

Description

@Puneethkumarck

Context

The console output formatter provides color-coded ANSI terminal output for live monitoring of the EVM indexer. Each event type has a distinct color tag for quick visual scanning. It can be toggled via the `CONSOLE_LOG` environment variable, except for block output which is always shown.

Specification

  • Layer: Infrastructure (`infrastructure/console/EvmConsoleOutputFormatter.java`)
  • Color-coded tags:
    • `[BLOCK]` — cyan bold: `Block: N (txs: M, gas: G%)`
    • `[TX]` — red: failed transaction
    • `[TX]` — white: normal successful transaction
    • `[TRANSFER]` — yellow bold: native transfer above threshold
    • `[ERC20]` — magenta bold: ERC-20 Transfer event
    • `[REORG]` — red bold: chain reorganization event
  • Truncation rules:
    • Transaction hash > 20 chars: display as `first8...last8`
    • Address > 16 chars: display as `first8...last8`
  • Toggle: Other output controlled by `CONSOLE_LOG` environment variable
  • Block tag (`[BLOCK]`) always shown regardless of `CONSOLE_LOG` setting (not gated by the toggle). This matches FR-13 in the functional spec: "Block summaries always shown (not gated by CONSOLE_LOG)".
  • Gas percentage: Computed as `(gasUsed / gasLimit) * 100`

Acceptance Criteria

  • Each event type produces output with the correct color tag
  • `[BLOCK]` output includes block number, transaction count, and gas percentage
  • `[BLOCK]` is always shown regardless of `CONSOLE_LOG` setting (not gated by the toggle)
  • `[TX]` uses red for failed transactions and white for successful ones
  • `[TRANSFER]` shows native transfers above threshold in yellow
  • `[ERC20]` shows token transfers in magenta
  • `[REORG]` shows reorg events in red
  • Hash truncation applies when length exceeds threshold
  • Address truncation applies when length exceeds threshold
  • Non-block console output can be toggled via `CONSOLE_LOG`
  • Unit tests verify each output path, truncation logic, and toggle behavior (including that BLOCK output bypasses the toggle)

Dependencies

  • EVM-12: EvmTransaction domain model (source data for formatting)

References

Metadata

Metadata

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions