Skip to content

[FSSDK-12298] logger adjustment#325

Merged
junaed-optimizely merged 7 commits intomasterfrom
junaed/fssdk-12298-logger-adjustment
Apr 8, 2026
Merged

[FSSDK-12298] logger adjustment#325
junaed-optimizely merged 7 commits intomasterfrom
junaed/fssdk-12298-logger-adjustment

Conversation

@junaed-optimizely
Copy link
Copy Markdown
Collaborator

@junaed-optimizely junaed-optimizely commented Apr 6, 2026

Summary

  • React SDK logger implementation: Added ReactLogger with level-filtered logging (debug, info, warn, error) and [OPTIMIZELY - REACT] - LEVEL prefix format, consistent with the JS SDK's [OPTIMIZELY] - LEVEL style
  • Symbol-based logger bundling: createLogger wraps the JS SDK's createLogger, attaches a ReactLogger onto the OpaqueLogger via a private symbol, and returns the same OpaqueLogger - no public API surface change. createInstance extracts the ReactLogger from the symbol (and deletes it) before passing the clean OpaqueLogger to the JS SDK, storing the ReactLogger in ReactClientMeta for use by hooks/providers

Test plan

Added 13 unit tests covering level resolution, level filtering, custom log handlers etc.

Issues

  • FSSDK-12298

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Introduces a React-specific logger wrapper around the JS SDK’s opaque logger config, and wires it into the React SDK surface area.

Changes:

  • Added src/logger/* with createLogger() (wraps JS SDK) and a ReactLogger with level filtering + handler support.
  • Updated OptimizelyProvider to use the new React logger accessor instead of an inline console logger.
  • Updated Vitest config and public exports so logger tests run and createLogger is exported from the React SDK entrypoint.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
vitest.config.mts Includes new logger unit tests and adds logger paths to coverage.
src/provider/OptimizelyProvider.tsx Switches provider error logging to getReactLogger().
src/logger/ReactLogger.ts Implements React logger abstraction with default console handler and level filtering.
src/logger/createLogger.ts Wraps JS SDK createLogger, resolves levels, stores a React logger singleton.
src/logger/index.ts Re-exports logger APIs/types from the new logger module.
src/logger/createLogger.spec.ts Adds Vitest unit tests for logger behavior.
src/index.ts Exposes createLogger from the new React logger module at the package root.
src/client/index.ts Stops re-exporting JS SDK createLogger from the client submodule.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@junaed-optimizely junaed-optimizely merged commit 57d1e67 into master Apr 8, 2026
10 checks passed
@junaed-optimizely junaed-optimizely deleted the junaed/fssdk-12298-logger-adjustment branch April 8, 2026 16:06
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.

3 participants