Skip to content

[EXTERNAL] fix: prefix browser-mode detection logs with [RevenueCat] - #1953

Merged
rickvdl merged 1 commit into
RevenueCat:rickvdl/fix-issue-1709from
cpruijsen:fix/issue-1709
Sep 11, 2026
Merged

[EXTERNAL] fix: prefix browser-mode detection logs with [RevenueCat]#1953
rickvdl merged 1 commit into
RevenueCat:rickvdl/fix-issue-1709from
cpruijsen:fix/issue-1709

Conversation

@cpruijsen

@cpruijsen cpruijsen commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Thank you for contributing to react-native-purchases. Before pressing the "Create Pull Request" button, please provide the following:

  • A description about what and why you are contributing, even if it's trivial.

  • The issue number(s) or PR number(s) in the description if you are contributing in response to those.

  • If applicable, unit tests.

Prefixes the three existing console.log calls in shouldUseBrowserMode() with [RevenueCat]. Other TypeScript logs from this package's default handler are tagged [RevenueCat], so the unprefixed web / Expo Go / Rork detection line is hard to filter in a busy console. Detection is unchanged: the log still runs at module import, before configure().

Prefix is [RevenueCat], not [purchases]. The issue asked for [purchases] "as other messages." Native iOS NSLog and purchases-js use [Purchases] / [purchases]. [RevenueCat] is already the TypeScript log tag in this package (default log handler, isConfigured(), etc.).

The detection logs are not gated on setLogLevel. The issue asked whether this line should respect log level. Deferring until configure() / setLogLevel(), or dropping the log, would be a larger behavior change: the log runs at module import, before any log level exists.

Can switch the prefix, or defer or silence the log.

Unit tests in __tests__/environment.test.ts assert the prefixed strings for web, Expo Go, and Rork, and that native iOS does not log.

Fixes #1709.


Note

Low Risk
Cosmetic log-prefix change only; no change to environment detection or purchase flow.

Overview
Prefixes the three browser-mode detection console.log lines in shouldUseBrowserMode() with [RevenueCat], matching the rest of this package’s TypeScript logging so those messages are easier to filter in the console.

Detection behavior is unchanged (web, Expo Go, Rork, native); only log text changes. Adds __tests__/environment.test.ts to assert the prefixed messages and that native iOS does not log.

Fixes #1709.

Reviewed by Cursor Bugbot for commit 3f96227. Bugbot is set up for automated code reviews on this repo. Configure here.

These messages fired as unprefixed console.log calls, so they were hard to filter among other packages in a web console. Use the same [RevenueCat] tag as the rest of this package's TypeScript logs.
@cpruijsen
cpruijsen requested a review from a team as a code owner September 11, 2026 00:37
@rickvdl
rickvdl changed the base branch from main to rickvdl/fix-issue-1709 September 11, 2026 06:21

@rickvdl rickvdl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks great! Thanks a lot 🙌

@rickvdl rickvdl changed the title fix: prefix browser-mode detection logs with [RevenueCat] [EXTERNAL] fix: prefix browser-mode detection logs with [RevenueCat] Sep 11, 2026
@rickvdl
rickvdl merged commit 2eccb6c into RevenueCat:rickvdl/fix-issue-1709 Sep 11, 2026
2 checks passed
rickvdl added a commit that referenced this pull request Sep 11, 2026
…1953) via @cpruijsen (#1954)

Thank you for contributing to react-native-purchases. Before pressing
the "Create Pull Request" button, please provide the following:

- [x] A description about what and why you are contributing, even if
it's trivial.

- [x] The issue number(s) or PR number(s) in the description if you are
contributing in response to those.

  - [x] If applicable, unit tests.

Prefixes the three existing `console.log` calls in
`shouldUseBrowserMode()` with `[RevenueCat]`. Other TypeScript logs from
this package's default handler are tagged `[RevenueCat]`, so the
unprefixed web / Expo Go / Rork detection line is hard to filter in a
busy console. Detection is unchanged: the log still runs at module
import, before `configure()`.

Prefix is `[RevenueCat]`, not `[purchases]`. The issue asked for
`[purchases]` "as other messages." Native iOS `NSLog` and purchases-js
use `[Purchases]` / `[purchases]`. `[RevenueCat]` is already the
TypeScript log tag in this package (default log handler,
`isConfigured()`, etc.).

The detection logs are not gated on `setLogLevel`. The issue asked
whether this line should respect log level. Deferring until
`configure()` / `setLogLevel()`, or dropping the log, would be a larger
behavior change: the log runs at module import, before any log level
exists.

Can switch the prefix, or defer or silence the log.

Unit tests in `__tests__/environment.test.ts` assert the prefixed
strings for web, Expo Go, and Rork, and that native iOS does not log.

Fixes #1709.


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Logging-only change with no impact on browser-mode detection or
purchase flows; covered by new unit tests.
> 
> **Overview**
> Browser-mode detection messages from `shouldUseBrowserMode()` now go
through a small `logBrowserModeDetection()` helper that prefixes them
with **`[RevenueCat]`**, matching other TypeScript logs in the package
so they are easier to filter in the console. **Detection behavior is
unchanged**—only the log format.
> 
> Adds **`__tests__/environment.test.ts`** with tests for prefixed web,
Expo Go, and Rork messages, and that native iOS does not emit these
logs.
> 
> Fixes #1709.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f5d8a28. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->



Thank you for contributing to react-native-purchases. Before pressing
the "Create Pull Request" button, please provide the following:

- [ ] A description about what and why you are contributing, even if
it's trivial.

- [ ] The issue number(s) or PR number(s) in the description if you are
contributing in response to those.

  - [ ] If applicable, unit tests.

---------

Co-authored-by: Christopher Pruijsen <christopher.pruijsen@gmail.com>
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.

[react-native-purchases] Message in web console "Web platform detected. Using RevenueCat in Browser Mode." doesnt have prefix [purchases]

2 participants