diff --git a/packages/wallet/CHANGELOG.md b/packages/wallet/CHANGELOG.md index b8fc334a16..c26c00fe90 100644 --- a/packages/wallet/CHANGELOG.md +++ b/packages/wallet/CHANGELOG.md @@ -15,5 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Passed to `RemoteFeatureFlagController` to trigger cache invalidation when the client version changes. - Add optional `fetch` field to `WalletOptions` ([#XXXX](https://github.com/MetaMask/core/pull/XXXX)) - Overrides the `fetch` implementation used by `NetworkController`'s RPC service. Defaults to `globalThis.fetch`. Allows platform-specific fetch implementations (e.g. React Native) to be injected. +- Add optional `logger` field to `WalletOptions` ([#XXXX](https://github.com/MetaMask/core/pull/XXXX)) + - When provided, emits an `info`-level log after each controller finishes initializing: `[wallet] ${ControllerName}: initialized`. Defaults to no-op (no output). Pass `console` during development to observe initialization order. [Unreleased]: https://github.com/MetaMask/core/ diff --git a/packages/wallet/src/initialization/initialization.ts b/packages/wallet/src/initialization/initialization.ts index 59443b393e..49b4e7b37c 100644 --- a/packages/wallet/src/initialization/initialization.ts +++ b/packages/wallet/src/initialization/initialization.ts @@ -32,6 +32,7 @@ export function initialize({ }); instances[name] = instance as Record; + options.logger?.info(`[wallet] ${name}: initialized`); } return instances as DefaultInstances; diff --git a/packages/wallet/src/types.ts b/packages/wallet/src/types.ts index ed66f427f6..63e74ec4bd 100644 --- a/packages/wallet/src/types.ts +++ b/packages/wallet/src/types.ts @@ -10,4 +10,5 @@ export type WalletOptions = { showApprovalRequest: () => void; clientConfigApiService: ClientConfigApiService; getMetaMetricsId: () => string; + logger?: Pick; };