hamagen-react-native
hamagen-react-native copied to clipboard
Remove/Avoid console.log calls in release build
There are several console.log calls in the code below:
it's better to remove/avoid them in release build, so they will run only in debug builds, if the messages are needed for later retrieval it's better use other mechanism which are built for this purpose (collecting logs/errors)
https://github.com/MohGovIL/hamagen-react-native/blob/8c6dd61db39d0974f33450220b3357394abc0652/src/services/BackgroundService.ts#L21
https://github.com/MohGovIL/hamagen-react-native/blob/a5e1d4db92fa2d197727f26f1f4ec37f40d3d0ea/src/services/LocationService.ts#L142 https://github.com/MohGovIL/hamagen-react-native/blob/a5e1d4db92fa2d197727f26f1f4ec37f40d3d0ea/src/services/LocationService.ts#L149
https://github.com/MohGovIL/hamagen-react-native/blob/a5e1d4db92fa2d197727f26f1f4ec37f40d3d0ea/src/actions/GeneralActions.ts#L109 https://github.com/MohGovIL/hamagen-react-native/blob/a5e1d4db92fa2d197727f26f1f4ec37f40d3d0ea/src/actions/GeneralActions.ts#L123
https://github.com/MohGovIL/hamagen-react-native/blob/151d5fa1ce46f2518aa7b8aed238123a755376ba/src/services/ErrorService.ts#L7
https://github.com/MohGovIL/hamagen-react-native/blob/e5606f3040c47b5c2713d432280273a99bcb2285/index.js#L31 https://github.com/MohGovIL/hamagen-react-native/blob/e5606f3040c47b5c2713d432280273a99bcb2285/index.js#L49
https://github.com/MohGovIL/hamagen-react-native/blob/0afc8cabc4ea82c8e3ef469f19f989c8c93de24e/src/services/WifiService.ts#L31 https://github.com/MohGovIL/hamagen-react-native/blob/0afc8cabc4ea82c8e3ef469f19f989c8c93de24e/src/services/WifiService.ts#L36
https://github.com/MohGovIL/hamagen-react-native/blob/e5606f3040c47b5c2713d432280273a99bcb2285/src/ResetMessaging.ts#L10 https://github.com/MohGovIL/hamagen-react-native/blob/e5606f3040c47b5c2713d432280273a99bcb2285/src/ResetMessaging.ts#L24
https://github.com/MohGovIL/hamagen-react-native/blob/a5e1d4db92fa2d197727f26f1f4ec37f40d3d0ea/src/database/Database.js#L690
https://github.com/MohGovIL/hamagen-react-native/blob/e5606f3040c47b5c2713d432280273a99bcb2285/src/services/Tracker.ts#L197 https://github.com/MohGovIL/hamagen-react-native/blob/e5606f3040c47b5c2713d432280273a99bcb2285/src/services/Tracker.ts#L223
https://github.com/MohGovIL/hamagen-react-native/blob/e5606f3040c47b5c2713d432280273a99bcb2285/src/actions/ExposuresActions.ts#L73
You can add this code to App.tsx
useEffect(() => {
StatusBar.setBarStyle('dark-content');
Linking.addEventListener('url', (data) => {
navigationRef.current && onOpenedFromDeepLink(data.url, navigationRef.current);
});
// Add the following
if (!__DEV__) {
console.disableYellowBox = true;
// disable console. log in production
console.log = () => { };
console.info = () => { };
console.warn = () => { };
console.error = () => { };
console.debug = () => { };
}
}, []);