[EXTERNAL] fix: prefix browser-mode detection logs with [RevenueCat] (#1953) via @cpruijsen - #1954
Merged
Conversation
…1953) 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** > 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. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 3f96227. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
tonidero
approved these changes
Sep 11, 2026
tonidero
reviewed
Sep 11, 2026
| return true; | ||
| } else if (isWebPlatform()) { | ||
| console.log('Web platform detected. Using RevenueCat in Browser Mode.'); | ||
| console.log('[RevenueCat] Web platform detected. Using RevenueCat in Browser Mode.'); |
Contributor
There was a problem hiding this comment.
I guess we could potentially build the message with the prefix in one place instead of adding the prefix in 3 places... But TBH, I think its fine as is :)
ajpallares
approved these changes
Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Prefixes the three existing
console.logcalls inshouldUseBrowserMode()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, beforeconfigure().Prefix is
[RevenueCat], not[purchases]. The issue asked for[purchases]"as other messages." Native iOSNSLogand 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 untilconfigure()/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.tsassert the prefixed strings for web, Expo Go, and Rork, and that native iOS does not log.Fixes #1709.
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 smalllogBrowserModeDetection()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.tswith tests for prefixed web, Expo Go, and Rork messages, and that native iOS does not emit these logs.Fixes #1709.
Reviewed by Cursor Bugbot for commit f5d8a28. Bugbot is set up for automated code reviews on this repo. Configure here.
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.