From e35628660caa9ea96ff31c6521353faa2edfe0bf Mon Sep 17 00:00:00 2001 From: Hannu Lyytikainen Date: Fri, 29 Sep 2017 10:45:03 +0300 Subject: [PATCH] Change the way util/log.js is imported Always import the whole module when using util/log.js. --- src/Routes.js | 4 ++-- src/components/BookingBreakdown/BookingBreakdown.js | 4 ++-- src/components/CurrencyInputField/CurrencyInputField.js | 4 ++-- src/containers/CheckoutPage/CheckoutPage.duck.js | 6 +++--- src/containers/EditListingPage/EditListingPage.duck.js | 6 +++--- src/containers/SalePage/SalePage.duck.js | 6 +++--- src/containers/SearchPage/SearchPage.js | 4 ++-- src/containers/StripePaymentForm/StripePaymentForm.js | 4 ++-- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Routes.js b/src/Routes.js index ac59f590..c0b1287a 100644 --- a/src/Routes.js +++ b/src/Routes.js @@ -6,7 +6,7 @@ import { NotFoundPage } from './containers'; import { NamedRedirect } from './components'; import { withFlattenedRoutes } from './util/contextHelpers'; import * as propTypes from './util/propTypes'; -import { error as logError } from './util/log'; +import * as log from './util/log'; const { bool, arrayOf, object, func, shape, string, any } = PropTypes; @@ -30,7 +30,7 @@ const callLoadData = props => { console.log(`loadData success for ${name} route`); }) .catch(e => { - logError(e, { route: route }); + log.error(e, { route: route }); }); } }; diff --git a/src/components/BookingBreakdown/BookingBreakdown.js b/src/components/BookingBreakdown/BookingBreakdown.js index fad67675..27375898 100644 --- a/src/components/BookingBreakdown/BookingBreakdown.js +++ b/src/components/BookingBreakdown/BookingBreakdown.js @@ -8,7 +8,7 @@ import classNames from 'classnames'; import { types } from '../../util/sdkLoader'; import { formatMoney } from '../../util/currency'; import * as propTypes from '../../util/propTypes'; -import { error as logError } from '../../util/log'; +import * as log from '../../util/log'; import css from './BookingBreakdown.css'; @@ -81,7 +81,7 @@ export const BookingBreakdownComponent = props => { const error = new Error( 'Commission should be present and the value should be zero or negative' ); - logError(error, { + log.error(error, { transactionId: transaction.id, }); throw error; diff --git a/src/components/CurrencyInputField/CurrencyInputField.js b/src/components/CurrencyInputField/CurrencyInputField.js index 41ebeb1a..3f6a2582 100644 --- a/src/components/CurrencyInputField/CurrencyInputField.js +++ b/src/components/CurrencyInputField/CurrencyInputField.js @@ -20,7 +20,7 @@ import { truncateToSubUnitPrecision, } from '../../util/currency'; import * as propTypes from '../../util/propTypes'; -import { error as logError } from '../../util/log'; +import * as log from '../../util/log'; import css from './CurrencyInputField.css'; @@ -82,7 +82,7 @@ class CurrencyInputComponent extends Component { usesComma, }; } catch (e) { - logError(e, { props: props }); + log.error(e, { props: props }); throw e; } diff --git a/src/containers/CheckoutPage/CheckoutPage.duck.js b/src/containers/CheckoutPage/CheckoutPage.duck.js index cf537ba7..804468e8 100644 --- a/src/containers/CheckoutPage/CheckoutPage.duck.js +++ b/src/containers/CheckoutPage/CheckoutPage.duck.js @@ -1,7 +1,7 @@ import { pick } from 'lodash'; import { updatedEntities, denormalisedEntities } from '../../util/data'; import * as propTypes from '../../util/propTypes'; -import { error as logError } from '../../util/log'; +import * as log from '../../util/log'; import { fetchCurrentUserHasOrdersSuccess } from '../../ducks/user.duck'; // ================ Action types ================ // @@ -120,7 +120,7 @@ export const initiateOrder = params => }) .catch(e => { dispatch(initiateOrderError(e)); - logError(e); + log.error(e); throw e; }); }; @@ -163,7 +163,7 @@ export const speculateTransaction = (listingId, bookingStart, bookingEnd) => dispatch(speculateTransactionSuccess(tx)); }) .catch(e => { - logError(e); + log.error(e); return dispatch(speculateTransactionError(e)); }); }; diff --git a/src/containers/EditListingPage/EditListingPage.duck.js b/src/containers/EditListingPage/EditListingPage.duck.js index dc9757d1..79311da1 100644 --- a/src/containers/EditListingPage/EditListingPage.duck.js +++ b/src/containers/EditListingPage/EditListingPage.duck.js @@ -1,6 +1,6 @@ import { omit, omitBy, isUndefined } from 'lodash'; import { types } from '../../util/sdkLoader'; -import { error as logError } from '../../util/log'; +import * as log from '../../util/log'; import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck'; import { fetchCurrentUserHasListingsSuccess } from '../../ducks/user.duck'; @@ -280,7 +280,7 @@ export function requestCreateListing(data) { return response; }) .catch(e => { - logError(e, { listingData: cleanedData }); + log.error(e, { listingData: cleanedData }); return dispatch(createListingError(e)); }); }; @@ -319,7 +319,7 @@ export function requestUpdateListing(tab, data) { dispatch(updateListingSuccess(updateResponse)); }) .catch(e => { - logError(e, { listingData: cleanedData }); + log.error(e, { listingData: cleanedData }); return dispatch(updateListingError(e)); }); }; diff --git a/src/containers/SalePage/SalePage.duck.js b/src/containers/SalePage/SalePage.duck.js index 876c736f..a3851f82 100644 --- a/src/containers/SalePage/SalePage.duck.js +++ b/src/containers/SalePage/SalePage.duck.js @@ -1,6 +1,6 @@ import { types } from '../../util/sdkLoader'; import * as propTypes from '../../util/propTypes'; -import { error as logError } from '../../util/log'; +import * as log from '../../util/log'; import { addMarketplaceEntities } from '../../ducks/marketplaceData.duck'; import { fetchCurrentUserNotifications } from '../../ducks/user.duck'; @@ -144,7 +144,7 @@ export const acceptSale = id => return response; }) .catch(e => { - logError(e, { txId: id, transition: propTypes.TX_TRANSITION_ACCEPT }); + log.error(e, { txId: id, transition: propTypes.TX_TRANSITION_ACCEPT }); dispatch(acceptSaleError(e)); throw e; }); @@ -166,7 +166,7 @@ export const rejectSale = id => return response; }) .catch(e => { - logError(e, { txId: id, transition: propTypes.TX_TRANSITION_REJECT }); + log.error(e, { txId: id, transition: propTypes.TX_TRANSITION_REJECT }); dispatch(rejectSaleError(e)); throw e; }); diff --git a/src/containers/SearchPage/SearchPage.js b/src/containers/SearchPage/SearchPage.js index d254af9b..198dd2ab 100644 --- a/src/containers/SearchPage/SearchPage.js +++ b/src/containers/SearchPage/SearchPage.js @@ -11,7 +11,7 @@ import { googleLatLngToSDKLatLng, googleBoundsToSDKBounds } from '../../util/goo import { createResourceLocatorString } from '../../util/routes'; import { createSlug, parse, stringify } from '../../util/urlHelpers'; import * as propTypes from '../../util/propTypes'; -import { error as logError } from '../../util/log'; +import * as log from '../../util/log'; import { getListingsById } from '../../ducks/marketplaceData.duck'; import { sendVerificationEmail } from '../../ducks/user.duck'; import { logout, authenticationInProgress } from '../../ducks/Auth.duck'; @@ -129,7 +129,7 @@ export class SearchPageComponent extends Component { // eslint-disable-next-line no-console console.error(`An error (${error} occured while trying to retrieve map listings`); - logError(error); + log.error(error); }); } diff --git a/src/containers/StripePaymentForm/StripePaymentForm.js b/src/containers/StripePaymentForm/StripePaymentForm.js index b3c5d9be..dc39a999 100644 --- a/src/containers/StripePaymentForm/StripePaymentForm.js +++ b/src/containers/StripePaymentForm/StripePaymentForm.js @@ -2,7 +2,7 @@ import React, { Component, PropTypes } from 'react'; import { FormattedMessage, injectIntl, intlShape } from 'react-intl'; import classNames from 'classnames'; import { PrimaryButton } from '../../components'; -import { error as logError } from '../../util/log'; +import * as log from '../../util/log'; import config from '../../config'; import css from './StripePaymentForm.css'; @@ -142,7 +142,7 @@ class StripePaymentForm extends Component { } }) .catch(e => { - logError(e, { stripeErrorType: e.type, stripeErrorCode: e.code }); + log.error(e, { stripeErrorType: e.type, stripeErrorCode: e.code }); this.setState({ submitting: false,