[EXTERNAL] fix: prefix browser-mode detection logs with [RevenueCat] - #1953
Merged
rickvdl merged 1 commit intoSep 11, 2026
Merged
Conversation
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.
rickvdl
approved these changes
Sep 11, 2026
rickvdl
left a comment
Member
There was a problem hiding this comment.
This looks great! Thanks a lot 🙌
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>
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.
If applicable, unit tests.
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
Cosmetic log-prefix change only; no change to environment detection or purchase flow.
Overview
Prefixes the three browser-mode detection
console.loglines inshouldUseBrowserMode()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.tsto 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.