mirror of
https://github.com/apache/superset.git
synced 2024-09-18 19:49:37 -04:00
chore: migrate console logs to logging service (#10608)
This commit is contained in:
parent
ca9ca99510
commit
08211953b2
@ -20,6 +20,7 @@ import PropTypes from 'prop-types';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Alert } from 'react-bootstrap';
|
import { Alert } from 'react-bootstrap';
|
||||||
import styled from '@superset-ui/style';
|
import styled from '@superset-ui/style';
|
||||||
|
import { logging } from '@superset-ui/core';
|
||||||
|
|
||||||
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
|
import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
|
||||||
import { Logger, LOG_ACTIONS_RENDER_CHART } from '../logger/LogUtils';
|
import { Logger, LOG_ACTIONS_RENDER_CHART } from '../logger/LogUtils';
|
||||||
@ -131,7 +132,7 @@ class Chart extends React.PureComponent {
|
|||||||
|
|
||||||
handleRenderContainerFailure(error, info) {
|
handleRenderContainerFailure(error, info) {
|
||||||
const { actions, chartId } = this.props;
|
const { actions, chartId } = this.props;
|
||||||
console.warn(error); // eslint-disable-line
|
logging.warn(error);
|
||||||
actions.chartRenderingFailed(
|
actions.chartRenderingFailed(
|
||||||
error.toString(),
|
error.toString(),
|
||||||
chartId,
|
chartId,
|
||||||
|
@ -20,6 +20,7 @@ import { snakeCase } from 'lodash';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { SuperChart } from '@superset-ui/chart';
|
import { SuperChart } from '@superset-ui/chart';
|
||||||
|
import { logging } from '@superset-ui/core';
|
||||||
import { Logger, LOG_ACTIONS_RENDER_CHART } from '../logger/LogUtils';
|
import { Logger, LOG_ACTIONS_RENDER_CHART } from '../logger/LogUtils';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
@ -124,7 +125,7 @@ class ChartRenderer extends React.Component {
|
|||||||
|
|
||||||
handleRenderFailure(error, info) {
|
handleRenderFailure(error, info) {
|
||||||
const { actions, chartId } = this.props;
|
const { actions, chartId } = this.props;
|
||||||
console.warn(error); // eslint-disable-line
|
logging.warn(error);
|
||||||
actions.chartRenderingFailed(
|
actions.chartRenderingFailed(
|
||||||
error.toString(),
|
error.toString(),
|
||||||
chartId,
|
chartId,
|
||||||
|
@ -23,6 +23,7 @@ import { bindActionCreators } from 'redux';
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import styled from '@superset-ui/style';
|
import styled from '@superset-ui/style';
|
||||||
import { t } from '@superset-ui/translation';
|
import { t } from '@superset-ui/translation';
|
||||||
|
import { logging } from '@superset-ui/core';
|
||||||
|
|
||||||
import ExploreChartPanel from './ExploreChartPanel';
|
import ExploreChartPanel from './ExploreChartPanel';
|
||||||
import ControlPanelsContainer from './ControlPanelsContainer';
|
import ControlPanelsContainer from './ControlPanelsContainer';
|
||||||
@ -247,8 +248,7 @@ class ExploreViewContainer extends React.Component {
|
|||||||
history.pushState(payload, title, longUrl);
|
history.pushState(payload, title, longUrl);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// eslint-disable-next-line no-console
|
logging.warn(
|
||||||
console.warn(
|
|
||||||
'Failed at altering browser history',
|
'Failed at altering browser history',
|
||||||
payload,
|
payload,
|
||||||
title,
|
title,
|
||||||
|
@ -21,6 +21,7 @@ import PropTypes from 'prop-types';
|
|||||||
|
|
||||||
import { t } from '@superset-ui/translation';
|
import { t } from '@superset-ui/translation';
|
||||||
import { SupersetClient } from '@superset-ui/connection';
|
import { SupersetClient } from '@superset-ui/connection';
|
||||||
|
import { logging } from '@superset-ui/core';
|
||||||
|
|
||||||
import OnPasteSelect from 'src/components/Select/OnPasteSelect';
|
import OnPasteSelect from 'src/components/Select/OnPasteSelect';
|
||||||
|
|
||||||
@ -127,8 +128,7 @@ export default class AdhocFilterControl extends React.Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
/* eslint-disable no-debugger, no-console */
|
logging.error('fetch extra_table_metadata:', error.statusText);
|
||||||
console.error('fetch extra_table_metadata:', error.statusText);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { SupersetClient } from '@superset-ui/connection';
|
import { SupersetClient } from '@superset-ui/connection';
|
||||||
|
import { logging } from '@superset-ui/core';
|
||||||
|
|
||||||
import { isEqual } from 'lodash';
|
import { isEqual } from 'lodash';
|
||||||
|
|
||||||
@ -67,7 +68,7 @@ export default function withVerification(
|
|||||||
this.setState({ validOptions: new Set(json) || new Set() });
|
this.setState({ validOptions: new Set(json) || new Set() });
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(error => console.log(error));
|
.catch(error => logging.log(error));
|
||||||
|
|
||||||
if (!this.state.hasRunVerification) {
|
if (!this.state.hasRunVerification) {
|
||||||
this.setState({ hasRunVerification: true });
|
this.setState({ hasRunVerification: true });
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
/* eslint no-console: 0 */
|
|
||||||
import { SupersetClient } from '@superset-ui/connection';
|
import { SupersetClient } from '@superset-ui/connection';
|
||||||
import parseCookie from 'src/utils/parseCookie';
|
import parseCookie from 'src/utils/parseCookie';
|
||||||
|
import { logging } from '@superset-ui/core';
|
||||||
|
|
||||||
export default function setupClient() {
|
export default function setupClient() {
|
||||||
const csrfNode = document.querySelector('#csrf_token');
|
const csrfNode = document.querySelector('#csrf_token');
|
||||||
@ -34,6 +34,6 @@ export default function setupClient() {
|
|||||||
})
|
})
|
||||||
.init()
|
.init()
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.warn('Error initializing SupersetClient', error);
|
logging.warn('Error initializing SupersetClient', error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ export const createFetchRelated = (
|
|||||||
export function createErrorHandler(handleErrorFunc: (errMsg?: string) => void) {
|
export function createErrorHandler(handleErrorFunc: (errMsg?: string) => void) {
|
||||||
return async (e: SupersetClientResponse | string) => {
|
return async (e: SupersetClientResponse | string) => {
|
||||||
const parsedError = await getClientErrorObject(e);
|
const parsedError = await getClientErrorObject(e);
|
||||||
console.error(e); // eslint-disable-line no-console
|
console.error(e);
|
||||||
handleErrorFunc(parsedError.message);
|
handleErrorFunc(parsedError.message);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user