MetaMask / MetaMask/core

wallet: Add injectable `logger` to `WalletOptions` for initialization diagnostics

Open
#8,791 0 comments 0 reactions 1 assignee View on GitHub

@grypez is already working on this.

Since May 26, 2026.

team-ocap-kernel
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

Sub-issue of #8790.

### Problem

There is no visibility into the order or timing of controller initialization. This makes it impossible to observe empirically which messenger actions are called during `init()` vs. at runtime — information needed to make the init-messenger pattern decision tracked in #8790.

### Proposed direction

Add an optional `logger?: Pick` field to `WalletOptions`. When provided, `initialize()` should call `logger.info(`[wallet] ${name}: initialized`)` immediately after each controller's `init()` call returns. The field should be no-op by default so library consumers are unaffected.

Passing `console` during development then gives a timestamped breadcrumb trail. Any messenger action call observed before a given controller's init-complete log is a candidate for an init messenger; calls observed after are runtime uses.

### Acceptance

- `WalletOptions.logger` is optional and defaults to no output.
- `initialize()` emits `[wallet] ${name}: initialized` via `logger?.info` after each controller init completes.
- Existing tests pass unchanged.
- Passing `{ info: console.info }` during a development run produces one log line per wired controller in initialization order.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.