-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable logs for staging and production native apps #30875
Disable logs for staging and production native apps #30875
Conversation
module.exports = (api) => { | ||
console.debug('babel.config.js'); | ||
console.debug(' - api.version:', api.version); | ||
console.debug(' - api.env:', api.env()); | ||
console.debug(' - process.env.NODE_ENV:', process.env.NODE_ENV); | ||
console.debug(' - process.env.BABEL_ENV:', process.env.BABEL_ENV); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've included these logs, because I've found out that when we're building the production web release, the environment output is development
, which is why the webpack
configuration above never used the env.production
path
env: { | ||
production: { | ||
presets: defaultPresets, | ||
plugins: [...defaultPlugins, 'transform-remove-console'], | ||
}, | ||
development: { | ||
presets: defaultPresets, | ||
plugins: defaultPlugins, | ||
}, | ||
}, | ||
presets: defaultPresets, | ||
plugins: defaultPlugins, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The
env.production
path were never engaged for web builds. The reason being,NODE_ENV
isn't defined before initiating the build process. - I'm omitting the 'transform-remove-console' plugin. Our intent is to retain console logs for web/desktop in production builds.
In essence, this modification aligns the dev and prod configurations, making them the same, hence the presented code change.
@robertKozik Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
12c9100
to
9579930
Compare
env: { | ||
production: { | ||
plugins: ['transform-remove-console', {exclude: ['error', 'warn']}], | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should preserve, the error
and warn
logs, because they aren't used frequently to impact the UX
That's why I've opted to keep them (exclude them from removal) here
How is the app reporting errors and crashes? Usually, the library of choice has a way to not completely disable logs but rather buffer them and choose a transport. By transport, you can then choose console output or Sentry or w/e. |
I believe the current setup uses Firebase Crashlytics to capture crashes and errors As for log transport, Expensify employs its proprietary logging library that transmits logs to the backend. In this PR, our primary objective is to cease the echoing of these logs on the client device without affecting the backend transmission. |
Reviewer Checklist
Screenshots/Videos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.96-6 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.96-15 🚀
|
🚀 Deployed to staging by https://github.com/mountiny in version: 1.3.98-0 🚀
|
Asked about QA in slack |
This PR is focused on performance optimization and doesn't introduce new features or bug fixes. Therefore, it might not require the usual QA procedures. However, I suggest the following:
I'm not familiar with the QA process, so if this approach isn't suitable or if performance gains aren't easily measurable, I understand that a standard QA might not be applicable here. |
The QA can be done in production too, we just need to check if there are no logs in server from the native apps. |
I think I have confirmed this works in staging, I did not log any push notifications received since this was deployed https://www.expensify.com/_devportal/tools/logSearch/#sort=asc&size=10000&query=blob%3A%22%5BPushNotification%5D%20push%20notification%20received%22%20AND%20email%3A%22vit%40expensify.com%22%20AND%20timestamp%3A%5B2023-11-09T00%3A00%20TO%202023-11-15T23%3A59%5D |
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.98-5 🚀
|
Details
error
andwarn
logs.webpack
presets and plugins.Fixed Issues
$ #30571
PROPOSAL: #30571 (comment)
Tests
For Mobile Native Apps (Android/iOS):
npm run android
npm run ios
DEV
mode is activated:D
in the terminal running the metro server.Settings
in the dev menu and ensure "JS DEV Mode" is checked.DEV
mode and refresh the app by pressingr
in the terminal running the metro server.For Web / mWeb / Desktop:
npm run web
npm run desktop
npm run build
and review the generated output in thedist
directory.dist/main-{hash}.js
. Searching forconsole.debug
should yield more than 30 matches.Backend check
Ensure logs are still being sent to the backend.
Monitor Network Activity:
https://www.expensify.com/api?command=Log
.Backend Logs Verification (For Authorized Personnel):
Offline tests
N/A: The changes are exclusive to the build process.
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Dev with debug logs
Prod no debug logs
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop