Skip to content

Conversation

aarsilv
Copy link
Contributor

@aarsilv aarsilv commented Oct 4, 2025

👯 Related PRs: js-sdk-common #296

Eppo Only:
🎟️ Tickets:

Motivation and Context

This common repository is shared with the Node.js and Browser JavaScript SDKs. The latter won't have a global process, causing errors unless a dummy global process is defined.

Also, currently, logging is hard-coded to be off (silent) for the Browser SDK. However, having logs can be helpful, especially for debugging.

Description

Use the latest common sdk with the updated application logger that now works with browsers.
Expose the setLogLevel() method for adjusting log levels.

Also clean up existing logger statements to fit Pino API of having the context object first.

How has this been documented?

How has this been tested?

  • Existing unit tests
  • Spun up sample browser app that worked without a dummy process. Also I saw no logs by default, error if I provided a bad SDK key, and then all the info logs if I changed the log level on purpose.
image


[Home](./index.md) > [@eppo/js-client-sdk](./js-client-sdk.md) > [LogLevel](./js-client-sdk.loglevel.md)

## LogLevel type
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New docs auto-generated for the externally exposed method and type for setting the SDK's log level

{
"name": "@eppo/js-client-sdk",
"version": "3.17.0",
"version": "3.18.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bumping minor version because of new public method and type

package.json Outdated
},
"dependencies": {
"@eppo/js-client-sdk-common": "4.15.1",
"@eppo/js-client-sdk-common": "/tmp/packages/js-sdk-common",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This will update once js-sdk-common #296 is merged

});
td.verify(
applicationLogger.error(
td.matchers.contains({ err: td.matchers.anything() }),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pino API (link) is to have the context object first.

yarn.lock Outdated
version "4.15.1"
resolved "https://registry.yarnpkg.com/@eppo/js-client-sdk-common/-/js-client-sdk-common-4.15.1.tgz#bf2d602b1462eb156224edd73f734a3c99267816"
integrity sha512-ZVyczDCfAMAnuUlfE293b6h2wfDOcZnfxXHS52r0OU9GktdTYD9EuC3Arpzw4JeTgzV1vW6iTzoz5HDJHwZz6A==
"@eppo/js-client-sdk-common@/tmp/packages/js-sdk-common":
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should update correctly once new version merged

@aarsilv aarsilv changed the title Aarsilv/ffesupport 100/fix browser logging issues Fix browser logging issues Oct 4, 2025
@aarsilv aarsilv marked this pull request as ready for review October 4, 2025 23:36
Copy link
Contributor

@sameerank sameerank left a comment

Choose a reason for hiding this comment

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

Don't forget to reference the correct @eppo/js-client-sdk-common version before merging!

}

// @public
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent';
Copy link
Contributor

Choose a reason for hiding this comment

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

We're not supporting 'fatal' in this list?

@aarsilv aarsilv merged commit ccb937a into main Oct 6, 2025
8 checks passed
@aarsilv aarsilv deleted the aarsilv/ffesupport-100/fix-browser-logging-issues branch October 6, 2025 20:39
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