diff --git a/src/components/AddPlaidBankAccount.js b/src/components/AddPlaidBankAccount.js index b88e2d58b095..2f3470730db7 100644 --- a/src/components/AddPlaidBankAccount.js +++ b/src/components/AddPlaidBankAccount.js @@ -7,6 +7,7 @@ import { import PropTypes from 'prop-types'; import lodashGet from 'lodash/get'; import {withOnyx} from 'react-native-onyx'; +import Log from '../libs/Log'; import PlaidLink from './PlaidLink'; import { clearPlaidBankAccountsAndToken, @@ -163,12 +164,12 @@ class AddPlaidBankAccount extends React.Component { { - console.debug('[PlaidLink] Success: ', {publicToken, metadata}); + Log.info('[PlaidLink] Success!'); getPlaidBankAccounts(publicToken, metadata.institution.name); this.setState({institution: metadata.institution}); }} onError={(error) => { - console.debug(`Plaid Error: ${error.message}`); + Log.hmmm('[PlaidLink] Error: ', error.message); }} // User prematurely exited the Plaid flow diff --git a/src/components/ImageWithSizeCalculation.js b/src/components/ImageWithSizeCalculation.js index 216269264e52..883254ccf2ef 100644 --- a/src/components/ImageWithSizeCalculation.js +++ b/src/components/ImageWithSizeCalculation.js @@ -1,6 +1,7 @@ import React, {PureComponent} from 'react'; import {Image} from 'react-native'; import PropTypes from 'prop-types'; +import Log from '../libs/Log'; import styles from '../styles/styles'; const propTypes = { @@ -63,7 +64,7 @@ class ImageWithSizeCalculation extends PureComponent { this.props.onMeasure({width, height}); }, (error) => { - console.debug('Unable to fetch image to calculate size', {error}); + Log.hmmm('Unable to fetch image to calculate size', {error, url: this.props.url}); }); } diff --git a/src/components/OptionsList.js b/src/components/OptionsList.js index 49506d291f35..360ff29135ba 100644 --- a/src/components/OptionsList.js +++ b/src/components/OptionsList.js @@ -2,6 +2,7 @@ import _ from 'underscore'; import React, {forwardRef, Component} from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; +import Log from '../libs/Log'; import styles from '../styles/styles'; import OptionRow from '../pages/home/sidebar/OptionRow'; import optionPropTypes from './optionPropTypes'; @@ -154,7 +155,7 @@ class OptionsList extends Component { * @param {Object} info */ onScrollToIndexFailed(info) { - console.debug(info); + Log.hmmm('[OptionsList] scrollToIndex failed', info); } /** diff --git a/src/components/PlaidLink/index.js b/src/components/PlaidLink/index.js index f753dca57d5c..472e1f373872 100644 --- a/src/components/PlaidLink/index.js +++ b/src/components/PlaidLink/index.js @@ -1,6 +1,7 @@ import {useCallback, useEffect} from 'react'; import {usePlaidLink} from 'react-plaid-link'; import {plaidLinkPropTypes, plaidLinkDefaultProps} from './plaidLinkPropTypes'; +import Log from '../../libs/Log'; const PlaidLink = (props) => { const onSuccess = useCallback((publicToken, metadata) => { @@ -11,11 +12,11 @@ const PlaidLink = (props) => { token: props.token, onSuccess, onExit: (exitError, metadata) => { - console.debug('[PlaidLink] Exit: ', {exitError, metadata}); + Log.info('[PlaidLink] Exit: ', false, {exitError, metadata}); props.onExit(); }, onEvent: (event, metadata) => { - console.debug('[PlaidLink] Event: ', {event, metadata}); + Log.info('[PlaidLink] Event: ', false, {event, metadata}); }, }); diff --git a/src/components/PlaidLink/index.native.js b/src/components/PlaidLink/index.native.js index 17a75bfe052c..da6fdf8dcb93 100644 --- a/src/components/PlaidLink/index.native.js +++ b/src/components/PlaidLink/index.native.js @@ -1,6 +1,7 @@ import React from 'react'; import {NativeEventEmitter} from 'react-native'; import {openLink} from 'react-native-plaid-link-sdk'; +import Log from '../../libs/Log'; import CONST from '../../CONST'; import nativeModule from './nativeModule'; import {plaidLinkPropTypes, plaidLinkDefaultProps} from './plaidLinkPropTypes'; @@ -35,7 +36,7 @@ class PlaidLink extends React.Component { * @param {*} event */ onEvent(event) { - console.debug('[PlaidLink] Handled Plaid Event: ', event); + Log.info('[PlaidLink] Handled Plaid Event: ', false, event); if (event.eventName === CONST.PLAID.EVENT.ERROR) { this.props.onError(event.metadata); } else if (event.eventName === CONST.PLAID.EVENT.EXIT) { diff --git a/src/libs/API.js b/src/libs/API.js index b87711ef3efe..8d12b62cf2e3 100644 --- a/src/libs/API.js +++ b/src/libs/API.js @@ -7,6 +7,9 @@ import redirectToSignIn from './actions/SignInRedirect'; import * as Network from './Network'; import isViaExpensifyCashNative from './isViaExpensifyCashNative'; +// eslint-disable-next-line import/no-cycle +import LogUtil from './Log'; + let isAuthenticating; let credentials; Onyx.connect({ @@ -57,7 +60,7 @@ function addDefaultValuesToParameters(command, parameters) { if (!authToken) { redirectToSignIn(); - console.debug('A request was made without an authToken', {command, parameters}); + LogUtil.info('A request was made without an authToken', false, {command, parameters}); Network.pauseRequestQueue(); Network.clearRequestQueue(); Network.unpauseRequestQueue(); @@ -172,7 +175,11 @@ Network.registerResponseHandler((queuedRequest, response) => { }); Network.registerErrorHandler((queuedRequest, error) => { - console.debug('[API] Handled error when making request', error); + if (queuedRequest.command !== 'Log') { + LogUtil.hmmm('[API] Handled error when making request', error); + } else { + console.debug('[API] There was an error in the Log API command, unable to log to server!', error); + } // Set an error state and signify we are done loading Onyx.merge(ONYXKEYS.SESSION, {loading: false, error: 'Cannot connect to server'}); @@ -304,7 +311,7 @@ function reauthenticate(command = '') { // If we experience something other than a network error then redirect the user to sign in redirectToSignIn(error.message); - console.debug('Redirecting to Sign In because we failed to reauthenticate', { + LogUtil.hmmm('Redirecting to Sign In because we failed to reauthenticate', { command, error: error.message, }); diff --git a/src/libs/Log.js b/src/libs/Log.js index 1bff8aa84fcb..9db56f5b7495 100644 --- a/src/libs/Log.js +++ b/src/libs/Log.js @@ -1,11 +1,13 @@ import Logger from 'expensify-common/lib/Logger'; -import * as API from './API'; import CONFIG from '../CONFIG'; import getPlatform from './getPlatform'; import {version} from '../../package.json'; import NetworkConnection from './NetworkConnection'; import HttpUtils from './HttpUtils'; +// eslint-disable-next-line import/no-cycle +import * as API from './API'; + let timeout = null; /** diff --git a/src/libs/Navigation/Navigation.js b/src/libs/Navigation/Navigation.js index 12279df62d2e..6292075296df 100644 --- a/src/libs/Navigation/Navigation.js +++ b/src/libs/Navigation/Navigation.js @@ -8,6 +8,7 @@ import { } from '@react-navigation/native'; import PropTypes from 'prop-types'; import Onyx from 'react-native-onyx'; +import Log from '../Log'; import linkTo from './linkTo'; import ROUTES from '../../ROUTES'; import SCREENS from '../../SCREENS'; @@ -39,7 +40,7 @@ function setDidTapNotification() { */ function openDrawer() { if (!navigationRef.isReady()) { - console.debug('[Navigation] openDrawer failed because navigation ref was not yet ready'); + Log.hmmm('[Navigation] openDrawer failed because navigation ref was not yet ready'); return; } navigationRef.current.dispatch(DrawerActions.openDrawer()); @@ -51,7 +52,7 @@ function openDrawer() { */ function closeDrawer() { if (!navigationRef.isReady()) { - console.debug('[Navigation] closeDrawer failed because navigation ref was not yet ready'); + Log.hmmm('[Navigation] closeDrawer failed because navigation ref was not yet ready'); return; } navigationRef.current.dispatch(DrawerActions.closeDrawer()); @@ -74,12 +75,12 @@ function getDefaultDrawerState(isSmallScreenWidth) { */ function goBack(shouldOpenDrawer = true) { if (!navigationRef.isReady()) { - console.debug('[Navigation] goBack failed because navigation ref was not yet ready'); + Log.hmmm('[Navigation] goBack failed because navigation ref was not yet ready'); return; } if (!navigationRef.current.canGoBack()) { - console.debug('Unable to go back'); + Log.hmmm('[Navigation] Unable to go back'); if (shouldOpenDrawer) { openDrawer(); } @@ -95,7 +96,7 @@ function goBack(shouldOpenDrawer = true) { */ function navigate(route = ROUTES.HOME) { if (!navigationRef.isReady()) { - console.debug('[Navigation] navigate failed because navigation ref was not yet ready'); + Log.hmmm('[Navigation] navigate failed because navigation ref was not yet ready', {route}); return; } @@ -129,7 +130,7 @@ function navigate(route = ROUTES.HOME) { */ function dismissModal(shouldOpenDrawer = false) { if (!navigationRef.isReady()) { - console.debug('[Navigation] dismissModal failed because navigation ref was not yet ready'); + Log.hmmm('[Navigation] dismissModal failed because navigation ref was not yet ready'); return; } diff --git a/src/libs/Notification/PushNotification/index.native.js b/src/libs/Notification/PushNotification/index.native.js index b36a1ee977b7..fe03dd3f4a28 100644 --- a/src/libs/Notification/PushNotification/index.native.js +++ b/src/libs/Notification/PushNotification/index.native.js @@ -2,6 +2,7 @@ import _ from 'underscore'; import {AppState} from 'react-native'; import {UrbanAirship, EventType} from 'urbanairship-react-native'; import lodashGet from 'lodash/get'; +import Log from '../../Log'; import NotificationType from './NotificationType'; const notificationEventActionMap = {}; @@ -21,25 +22,21 @@ function pushNotificationEventCallback(eventType, notification) { payload = JSON.parse(payload); } - console.debug(`[PUSH_NOTIFICATION] ${eventType}`, { - title: notification.title, - message: notification.alert, - payload, - }); + Log.info(`[PUSH_NOTIFICATION] Callback triggered for ${eventType}`); if (!payload) { - console.debug('[PUSH_NOTIFICATION] Notification has null or undefined payload, not executing any callback.'); + Log.warn('[PUSH_NOTIFICATION] Notification has null or undefined payload, not executing any callback.'); return; } if (!payload.type) { - console.debug('[PUSH_NOTIFICATION] No type value provided in payload, not executing any callback.'); + Log.warn('[PUSH_NOTIFICATION] No type value provided in payload, not executing any callback.'); return; } const action = actionMap[payload.type]; if (!action) { - console.debug('[PUSH_NOTIFICATION] No callback set up: ', { + Log.warn('[PUSH_NOTIFICATION] No callback set up: ', { event: eventType, notificationType: payload.type, }); @@ -61,7 +58,7 @@ function init() { // If a push notification is received while the app is in foreground, // we'll assume pusher is connected so we'll ignore it and not fetch the same data twice. if (AppState.currentState === 'active') { - console.debug('[PUSH_NOTIFICATION] Push received while app is in foreground, not executing any callback.'); + Log.info('[PUSH_NOTIFICATION] Push received while app is in foreground, not executing any callback.'); return; } @@ -90,13 +87,13 @@ function register(accountID) { UrbanAirship.enableUserPushNotifications() .then((isEnabled) => { if (!isEnabled) { - console.debug('[PUSH_NOTIFICATIONS] User has disabled visible push notifications for this app.'); + Log.info('[PUSH_NOTIFICATIONS] User has disabled visible push notifications for this app.'); } }); // Register this device as a named user in AirshipAPI. // Regardless of the user's opt-in status, we still want to receive silent push notifications. - console.debug(`[PUSH_NOTIFICATIONS] Subscribing to notifications for account ID ${accountID}`); + Log.info(`[PUSH_NOTIFICATIONS] Subscribing to notifications for account ID ${accountID}`); UrbanAirship.setNamedUser(accountID.toString()); } @@ -104,7 +101,7 @@ function register(accountID) { * Deregister this device from push notifications. */ function deregister() { - console.debug('[PUSH_NOTIFICATIONS] Unsubscribing from push notifications.'); + Log.info('[PUSH_NOTIFICATIONS] Unsubscribing from push notifications.'); UrbanAirship.setNamedUser(null); UrbanAirship.removeAllListeners(EventType.PushReceived); UrbanAirship.removeAllListeners(EventType.NotificationResponse); diff --git a/src/libs/Pusher/pusher.js b/src/libs/Pusher/pusher.js index e64644c1441d..1809a08d7ef1 100644 --- a/src/libs/Pusher/pusher.js +++ b/src/libs/Pusher/pusher.js @@ -1,6 +1,7 @@ import _ from 'underscore'; import Pusher from './library'; import TYPE from './EventType'; +import Log from '../Log'; let socket; const socketEventCallbacks = []; @@ -118,7 +119,7 @@ function bindEventToChannel(channel, eventName, eventCallback = () => {}, isChun try { data = _.isObject(eventData) ? eventData : JSON.parse(eventData); } catch (err) { - console.debug('Unable to parse JSON response from Pusher', 0, {error: err, eventData}); + Log.alert('[Pusher] Unable to parse JSON response from Pusher', {error: err, eventData}); return; } @@ -151,7 +152,7 @@ function bindEventToChannel(channel, eventName, eventCallback = () => {}, isChun try { eventCallback(JSON.parse(chunkedEvent.chunks.join(''))); } catch (err) { - console.debug('[Pusher] Unable to parse chunked JSON response from Pusher', 0, { + Log.alert('[Pusher] Unable to parse chunked JSON response from Pusher', { error: err, eventData: chunkedEvent.chunks.join(''), }); @@ -193,7 +194,7 @@ function subscribe( most likely has been called before Pusher.init()`); } - console.debug('[Pusher] Attempting to subscribe to channel', true, {channelName, eventName}); + Log.info('[Pusher] Attempting to subscribe to channel', false, {channelName, eventName}); let channel = getChannel(channelName); if (!channel || !channel.subscribed) { @@ -217,7 +218,7 @@ function subscribe( channel.bind('pusher:subscription_error', (status) => { if (status === 403) { - console.debug('[Pusher] Issue authenticating with Pusher during subscribe attempt.', 0, { + Log.hmmm('[Pusher] Issue authenticating with Pusher during subscribe attempt.', { channelName, status, }); @@ -243,21 +244,19 @@ function unsubscribe(channelName, eventName = '') { const channel = getChannel(channelName); if (!channel) { - console.debug(`[Pusher] Attempted to unsubscribe or unbind from a channel, - but Pusher-JS has no knowledge of it`, 0, {channelName, eventName}); + Log.hmmm('[Pusher] Attempted to unsubscribe or unbind from a channel, but Pusher-JS has no knowledge of it', {channelName, eventName}); return; } if (eventName) { - console.debug('[Pusher] Unbinding event', true, {eventName, channelName}); + Log.info('[Pusher] Unbinding event', false, {eventName, channelName}); channel.unbind(eventName); } else { if (!channel.subscribed) { - console.debug(`[Pusher] Attempted to unsubscribe from channel, - but we are not subscribed to begin with`, 0, {channelName}); + Log.info('Pusher] Attempted to unsubscribe from channel, but we are not subscribed to begin with', false, {channelName}); return; } - console.debug('[Pusher] Unsubscribing from channel', true, {channelName}); + Log.info('[Pusher] Unsubscribing from channel', false, {channelName}); channel.unbind(); socket.unsubscribe(channelName); @@ -339,7 +338,7 @@ function registerCustomAuthorizer(authorizer) { */ function disconnect() { if (!socket) { - console.debug('[Pusher] Attempting to disconnect from Pusher before initialisation has occurred, ignoring.'); + Log.info('[Pusher] Attempting to disconnect from Pusher before initialisation has occurred, ignoring.'); return; } @@ -352,11 +351,11 @@ function disconnect() { */ function reconnect() { if (!socket) { - console.debug('[Pusher] Unable to reconnect since Pusher instance does not yet exist.'); + Log.info('[Pusher] Unable to reconnect since Pusher instance does not yet exist.'); return; } - console.debug('[Pusher] Reconnecting to Pusher'); + Log.info('[Pusher] Reconnecting to Pusher'); socket.disconnect(); socket.connect(); } diff --git a/src/libs/actions/PersonalDetails.js b/src/libs/actions/PersonalDetails.js index 91f5c9b4e83a..4af4da39780d 100644 --- a/src/libs/actions/PersonalDetails.js +++ b/src/libs/actions/PersonalDetails.js @@ -128,8 +128,7 @@ function fetchPersonalDetails() { // Set my personal details so they can be easily accessed and subscribed to on their own key Onyx.merge(ONYXKEYS.MY_PERSONAL_DETAILS, myPersonalDetails); - }) - .catch(error => console.debug('Error fetching personal details', error)); + }); } /** @@ -261,7 +260,6 @@ function fetchLocalCurrency() { .then(() => { Onyx.merge(ONYXKEYS.MY_PERSONAL_DETAILS, {localCurrencyCode: currency}); }) - .catch(error => console.debug(`Error fetching currency preference: , ${error}`)) .finally(() => { Onyx.merge(ONYXKEYS.IOU, { isRetrievingCurrency: false, diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 2c543efc17af..dda6d7fb6bea 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -267,7 +267,7 @@ function fetchIOUReport(iouReportID, chatReportID) { } return getSimplifiedIOUReport(iouReportData, chatReportID); }).catch((error) => { - console.debug(`[Report] Failed to populate IOU Collection: ${error.message}`); + Log.hmmm('[Report] Failed to populate IOU Collection:', error.message); }); } @@ -290,7 +290,7 @@ function fetchIOUReportID(debtorEmail) { // If there is no IOU report for this user then we will assume it has been paid and do nothing here. // All reports are initialized with hasOutstandingIOU: false. Since the IOU report we were looking for has // been settled then there's nothing more to do. - console.debug('GetIOUReport returned a reportID of 0, not fetching IOU report data'); + Log.info('GetIOUReport returned a reportID of 0, not fetching IOU report data'); return; } return iouReportID; @@ -604,26 +604,26 @@ function updateReportWithNewAction( } if (!ActiveClientManager.isClientTheLeader()) { - console.debug('[LOCAL_NOTIFICATION] Skipping notification because this client is not the leader'); + Log.info('[LOCAL_NOTIFICATION] Skipping notification because this client is not the leader'); return; } // We don't want to send a local notification if the user preference is daily or mute if (notificationPreference === 'mute' || notificationPreference === 'daily') { // eslint-disable-next-line max-len - console.debug(`[LOCAL_NOTIFICATION] No notification because user preference is to be notified: ${notificationPreference}`); + Log.info(`[LOCAL_NOTIFICATION] No notification because user preference is to be notified: ${notificationPreference}`); return; } // If this comment is from the current user we don't want to parrot whatever they wrote back to them. if (isFromCurrentUser) { - console.debug('[LOCAL_NOTIFICATION] No notification because comment is from the currently logged in user'); + Log.info('[LOCAL_NOTIFICATION] No notification because comment is from the currently logged in user'); return; } // If we are currently viewing this report do not show a notification. if (reportID === lastViewedReportID && Visibility.isVisible()) { - console.debug('[LOCAL_NOTIFICATION] No notification because it was a comment for the current report'); + Log.info('[LOCAL_NOTIFICATION] No notification because it was a comment for the current report'); return; } @@ -639,7 +639,7 @@ function updateReportWithNewAction( const oldestUnreadSeq = (updatedReportObject.maxSequenceNumber - updatedReportObject.unreadActionCount) + 1; setNewMarkerPosition(reportID, oldestUnreadSeq); } - console.debug('[LOCAL_NOTIFICATION] Creating notification'); + Log.info('[LOCAL_NOTIFICATION] Creating notification'); LocalNotification.showCommentNotification({ reportAction, onClick: () => { @@ -978,11 +978,11 @@ function fetchAllReports( .value(); if (_.isEmpty(reportIDsToFetchActions)) { - console.debug('[Report] Local reportActions up to date. Not fetching additional actions.'); + Log.info('[Report] Local reportActions up to date. Not fetching additional actions.'); return; } - console.debug('[Report] Fetching reportActions for reportIDs: ', { + Log.info('[Report] Fetching reportActions for reportIDs: ', false, { reportIDs: reportIDsToFetchActions, }); _.each(reportIDsToFetchActions, (reportID) => { diff --git a/src/libs/actions/Session.js b/src/libs/actions/Session.js index a70ec279d3b3..f0f4f42f8982 100644 --- a/src/libs/actions/Session.js +++ b/src/libs/actions/Session.js @@ -82,7 +82,7 @@ function signOut() { } Timing.clearData(); redirectToSignIn(); - console.debug('Redirecting to Sign In because signOut() was called'); + Log.info('Redirecting to Sign In because signOut() was called'); } /** @@ -194,7 +194,7 @@ function createTemporaryLogin(authToken, encryptedAuthToken, email) { partnerPassword: CONFIG.EXPENSIFY.PARTNER_PASSWORD, doNotRetry: true, }) - .catch(console.debug); + .catch(Log.info); } Onyx.merge(ONYXKEYS.CREDENTIALS, { diff --git a/src/libs/actions/User.js b/src/libs/actions/User.js index faaafe5d1b5b..4226e38e6806 100644 --- a/src/libs/actions/User.js +++ b/src/libs/actions/User.js @@ -245,7 +245,7 @@ function getDomainInfo() { }); } else { // eslint-disable-next-line max-len - console.debug(`Command User_IsFromPublicDomain returned error code: ${response.jsonCode}. Most likely, this means that the domain ${Str.extractEmail(sessionEmail)} is not in the bedrock cache. Retrying in ${RETRY_TIMEOUT / 1000 / 60} minutes`); + Log.info(`Command User_IsFromPublicDomain returned error code: ${response.jsonCode}. Most likely, this means that the domain ${Str.extractEmail(sessionEmail)} is not in the bedrock cache. Retrying in ${RETRY_TIMEOUT / 1000 / 60} minutes`); setTimeout(getDomainInfo, RETRY_TIMEOUT); } }); diff --git a/src/libs/listenToStorageEvents/index.js b/src/libs/listenToStorageEvents/index.js index a51efcf636e5..bf061aa847fa 100644 --- a/src/libs/listenToStorageEvents/index.js +++ b/src/libs/listenToStorageEvents/index.js @@ -1,3 +1,5 @@ +import Log from '../Log'; + /** * Listens for storage events so that multiple tabs can keep track of what * other tabs are doing @@ -10,7 +12,7 @@ function listenToStorageEvents(callback) { try { newValue = JSON.parse(e.newValue); } catch (err) { - console.debug('Could not parse the newValue of the storage event', err, e); + Log.hmmm('Could not parse the newValue of the storage event', {event: e.key, error: err}); } if (newValue !== undefined) { callback(e.key, newValue); diff --git a/src/libs/migrateOnyx.js b/src/libs/migrateOnyx.js index 3466bc2606b6..0a3d22fde16b 100644 --- a/src/libs/migrateOnyx.js +++ b/src/libs/migrateOnyx.js @@ -1,10 +1,11 @@ +import Log from './Log'; import AddEncryptedAuthToken from './migrations/AddEncryptedAuthToken'; import RenameActiveClientsKey from './migrations/RenameActiveClientsKey'; import RenamePriorityModeKey from './migrations/RenamePriorityModeKey'; export default function () { const startTime = Date.now(); - console.debug('[Migrate Onyx] start'); + Log.info('[Migrate Onyx] start'); return new Promise((resolve) => { // Add all migrations to an array so they are executed in order @@ -28,7 +29,7 @@ export default function () { // Once all migrations are done, resolve the main promise .then(() => { const timeElapsed = Date.now() - startTime; - console.debug(`[Migrate Onyx] finished in ${timeElapsed}ms`); + Log.info(`[Migrate Onyx] finished in ${timeElapsed}ms`); resolve(); }); }); diff --git a/src/libs/migrations/AddEncryptedAuthToken.js b/src/libs/migrations/AddEncryptedAuthToken.js index 24660b4f3a91..e8277ff12877 100644 --- a/src/libs/migrations/AddEncryptedAuthToken.js +++ b/src/libs/migrations/AddEncryptedAuthToken.js @@ -1,5 +1,6 @@ import _ from 'underscore'; import Onyx from 'react-native-onyx'; +import Log from '../Log'; import ONYXKEYS from '../../ONYXKEYS'; import {reauthenticate} from '../API'; @@ -16,12 +17,12 @@ export default function () { Onyx.disconnect(connectionID); if (session && !_.isEmpty(session.encryptedAuthToken)) { - console.debug('[Migrate Onyx] Skipped migration AddEncryptedAuthToken'); + Log.info('[Migrate Onyx] Skipped migration AddEncryptedAuthToken'); return resolve(); } if (!session || !session.authToken) { - console.debug('[Migrate Onyx] Skipped migration AddEncryptedAuthToken'); + Log.info('[Migrate Onyx] Skipped migration AddEncryptedAuthToken'); return resolve(); } @@ -29,7 +30,7 @@ export default function () { if (session.authToken && _.isUndefined(session.encryptedAuthToken)) { return reauthenticate('Onyx_Migration_AddEncryptedAuthToken') .then(() => { - console.debug('[Migrate Onyx] Ran migration AddEncryptedAuthToken'); + Log.info('[Migrate Onyx] Ran migration AddEncryptedAuthToken'); return resolve(); }); } diff --git a/src/libs/migrations/RenameActiveClientsKey.js b/src/libs/migrations/RenameActiveClientsKey.js index 14178a15a8e0..ff3a0941eafe 100644 --- a/src/libs/migrations/RenameActiveClientsKey.js +++ b/src/libs/migrations/RenameActiveClientsKey.js @@ -1,5 +1,6 @@ import Onyx from 'react-native-onyx'; import _ from 'underscore'; +import Log from '../Log'; import ONYXKEYS from '../../ONYXKEYS'; // This migration changes the name of the Onyx key ACTIVE_CLIENTS from activeClients2 to activeClients @@ -15,7 +16,7 @@ export default function () { // Fail early here because there is nothing to migrate if (_.isEmpty(oldActiveClients)) { - console.debug('[Migrate Onyx] Skipped migration RenameActiveClientsKey'); + Log.info('[Migrate Onyx] Skipped migration RenameActiveClientsKey'); return resolve(); } @@ -24,7 +25,7 @@ export default function () { [ONYXKEYS.ACTIVE_CLIENTS]: oldActiveClients, }) .then(() => { - console.debug('[Migrate Onyx] Ran migration RenameActiveClientsKey'); + Log.info('[Migrate Onyx] Ran migration RenameActiveClientsKey'); resolve(); }); }, diff --git a/src/libs/migrations/RenamePriorityModeKey.js b/src/libs/migrations/RenamePriorityModeKey.js index c80c1058bbae..3e0bc44e78bd 100644 --- a/src/libs/migrations/RenamePriorityModeKey.js +++ b/src/libs/migrations/RenamePriorityModeKey.js @@ -1,6 +1,7 @@ import Onyx from 'react-native-onyx'; import _ from 'underscore'; import ONYXKEYS from '../../ONYXKEYS'; +import Log from '../Log'; // This migration changes the name of the Onyx key NVP_PRIORITY_MODE from priorityMode to nvp_priorityMode export default function () { @@ -15,7 +16,7 @@ export default function () { // Fail early here because there is nothing to migrate if (_.isEmpty(oldPriorityMode)) { - console.debug('[Migrate Onyx] Skipped migration RenamePriorityModeKey'); + Log.info('[Migrate Onyx] Skipped migration RenamePriorityModeKey'); return resolve(); } @@ -24,7 +25,7 @@ export default function () { [ONYXKEYS.NVP_PRIORITY_MODE]: oldPriorityMode, }) .then(() => { - console.debug('[Migrate Onyx] Ran migration RenamePriorityModeKey'); + Log.info('[Migrate Onyx] Ran migration RenamePriorityModeKey'); resolve(); }); }, diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js index bacb0053b804..6ca95a86f00f 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js @@ -5,6 +5,7 @@ import {withOnyx} from 'react-native-onyx'; import Str from 'expensify-common/lib/str'; import {View} from 'react-native'; import PropTypes from 'prop-types'; +import Log from '../../libs/Log'; import ScreenWrapper from '../../components/ScreenWrapper'; import { fetchFreePlanVerifiedBankAccount, @@ -146,7 +147,7 @@ class ReimbursementAccountPage extends React.Component { render() { if (!Permissions.canUseFreePlan(this.props.betas)) { - console.debug('Not showing new bank account page because user is not on free plan beta'); + Log.info('Not showing new bank account page because user is not on free plan beta'); Navigation.dismissModal(); return null; } diff --git a/src/pages/workspace/WorkspaceMembersPage.js b/src/pages/workspace/WorkspaceMembersPage.js index 5dc67e9f0aa7..aed82af5883f 100644 --- a/src/pages/workspace/WorkspaceMembersPage.js +++ b/src/pages/workspace/WorkspaceMembersPage.js @@ -7,6 +7,7 @@ import { import PropTypes from 'prop-types'; import {withOnyx} from 'react-native-onyx'; import Str from 'expensify-common/lib/str'; +import Log from '../../libs/Log'; import styles from '../../styles/styles'; import ONYXKEYS from '../../ONYXKEYS'; import HeaderWithCloseButton from '../../components/HeaderWithCloseButton'; @@ -247,7 +248,7 @@ class WorkspaceMembersPage extends React.Component { render() { if (!Permissions.canUseFreePlan(this.props.betas)) { - console.debug('Not showing workspace people page because user is not on free plan beta'); + Log.info('Not showing workspace people page because user is not on free plan beta'); return ; } const policyEmployeeList = lodashGet(this.props, 'policy.employeeList', []); diff --git a/src/pages/workspace/WorkspaceSettingsPage.js b/src/pages/workspace/WorkspaceSettingsPage.js index 53db39638bff..0fd5dda0bb99 100644 --- a/src/pages/workspace/WorkspaceSettingsPage.js +++ b/src/pages/workspace/WorkspaceSettingsPage.js @@ -4,6 +4,7 @@ import {withOnyx} from 'react-native-onyx'; import PropTypes from 'prop-types'; import lodashGet from 'lodash/get'; import _ from 'underscore'; +import Log from '../../libs/Log'; import ONYXKEYS from '../../ONYXKEYS'; import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; import Navigation from '../../libs/Navigation/Navigation'; @@ -124,7 +125,7 @@ class WorkspaceSettingsPage extends React.Component { const {policy} = this.props; if (!Permissions.canUseFreePlan(this.props.betas)) { - console.debug('Not showing workspace editor page because user is not on free plan beta'); + Log.info('Not showing workspace editor page because user is not on free plan beta'); return ; }