Skip to content

feat(hub): add ForkableHub WithLogger option#56

Merged
maoueh merged 2 commits into
developfrom
feature/processing-block-log-repeated-missing-tagging
Jun 11, 2026
Merged

feat(hub): add ForkableHub WithLogger option#56
maoueh merged 2 commits into
developfrom
feature/processing-block-log-repeated-missing-tagging

Conversation

@maoueh

@maoueh maoueh commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Problem

ForkableHub had no per-instance logger — every line (including processing block) used the package-level bstream logger. Components running their own hub (relayer, firehose, tier1, ...) all logged under the same bstream identifier, making it impossible to tell which component emitted a given line.

Change

  • Add a logger *zap.Logger field to ForkableHub, defaulting to the package zlog.
  • Add WithLogger(logger) hub option. The logger is propagated to the inner forkable by default, so its block-level lines are attributed to the same component (callers can still override via forkable.WithLogger in extraForkableOptions).
  • Receiver-method logging switched from zlog. to h.logger.. Two nil-safe sites kept on the package logger: the SOURCE_CHAN_SIZE parse warning (hub not yet built) and forkable hub not ready (reachable when h == nil).

Downstream

Callers should pass their component logger:

  • substreams tier1
  • firehose-core relayer + firehose app

(separate PRs)

Test

go test ./hub/... ./forkable/...

maoueh and others added 2 commits June 10, 2026 23:25
ForkableHub previously logged everything under the package-level `bstream`
logger, so lines such as `processing block` were indistinguishable across
components running their own hub (relayer, firehose, tier1, ...).

Add a `logger` field and `WithLogger` option. The logger is propagated to the
inner forkable by default so its block-level lines are attributed too. Receiver
methods now log through `h.logger`; the two nil-safe sites (SOURCE_CHAN_SIZE
parse warning and "forkable hub not ready") keep using the package logger.

@sduchesneau sduchesneau left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maoueh maoueh merged commit 4edda1c into develop Jun 11, 2026
4 checks passed
@maoueh maoueh deleted the feature/processing-block-log-repeated-missing-tagging branch June 11, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants