Change the way util/log.js is imported

Always import the whole module when using util/log.js.
This commit is contained in:
Hannu Lyytikainen 2017-09-29 10:45:03 +03:00
parent 8520edd1d2
commit e35628660c
8 changed files with 19 additions and 19 deletions

View file

@ -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 });
});
}
};

View file

@ -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;

View file

@ -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;
}

View file

@ -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));
});
};

View file

@ -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));
});
};

View file

@ -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;
});

View file

@ -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);
});
}

View file

@ -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,