You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2020/08/17 03:21:13 UTC

[incubator-superset] branch master updated: chore: migrate console logs to logging service (#10608)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 0821195  chore: migrate console logs to logging service (#10608)
0821195 is described below

commit 08211953b2e1b356f8d13aed37c1bcfc2cb9a615
Author: Evan Rusackas <ev...@preset.io>
AuthorDate: Sun Aug 16 20:20:47 2020 -0700

    chore: migrate console logs to logging service (#10608)
---
 superset-frontend/src/chart/Chart.jsx                                 | 3 ++-
 superset-frontend/src/chart/ChartRenderer.jsx                         | 3 ++-
 superset-frontend/src/explore/components/ExploreViewContainer.jsx     | 4 ++--
 .../src/explore/components/controls/AdhocFilterControl.jsx            | 4 ++--
 .../src/explore/components/controls/withVerification.jsx              | 3 ++-
 superset-frontend/src/setup/setupClient.js                            | 4 ++--
 superset-frontend/src/views/CRUD/utils.tsx                            | 2 +-
 7 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/superset-frontend/src/chart/Chart.jsx b/superset-frontend/src/chart/Chart.jsx
index 2a6b846..b922228 100644
--- a/superset-frontend/src/chart/Chart.jsx
+++ b/superset-frontend/src/chart/Chart.jsx
@@ -20,6 +20,7 @@ import PropTypes from 'prop-types';
 import React from 'react';
 import { Alert } from 'react-bootstrap';
 import styled from '@superset-ui/style';
+import { logging } from '@superset-ui/core';
 
 import { isFeatureEnabled, FeatureFlag } from 'src/featureFlags';
 import { Logger, LOG_ACTIONS_RENDER_CHART } from '../logger/LogUtils';
@@ -131,7 +132,7 @@ class Chart extends React.PureComponent {
 
   handleRenderContainerFailure(error, info) {
     const { actions, chartId } = this.props;
-    console.warn(error); // eslint-disable-line
+    logging.warn(error);
     actions.chartRenderingFailed(
       error.toString(),
       chartId,
diff --git a/superset-frontend/src/chart/ChartRenderer.jsx b/superset-frontend/src/chart/ChartRenderer.jsx
index 58ea5c5..8c5010f 100644
--- a/superset-frontend/src/chart/ChartRenderer.jsx
+++ b/superset-frontend/src/chart/ChartRenderer.jsx
@@ -20,6 +20,7 @@ import { snakeCase } from 'lodash';
 import PropTypes from 'prop-types';
 import React from 'react';
 import { SuperChart } from '@superset-ui/chart';
+import { logging } from '@superset-ui/core';
 import { Logger, LOG_ACTIONS_RENDER_CHART } from '../logger/LogUtils';
 
 const propTypes = {
@@ -124,7 +125,7 @@ class ChartRenderer extends React.Component {
 
   handleRenderFailure(error, info) {
     const { actions, chartId } = this.props;
-    console.warn(error); // eslint-disable-line
+    logging.warn(error);
     actions.chartRenderingFailed(
       error.toString(),
       chartId,
diff --git a/superset-frontend/src/explore/components/ExploreViewContainer.jsx b/superset-frontend/src/explore/components/ExploreViewContainer.jsx
index 6104216..6b96423 100644
--- a/superset-frontend/src/explore/components/ExploreViewContainer.jsx
+++ b/superset-frontend/src/explore/components/ExploreViewContainer.jsx
@@ -23,6 +23,7 @@ import { bindActionCreators } from 'redux';
 import { connect } from 'react-redux';
 import styled from '@superset-ui/style';
 import { t } from '@superset-ui/translation';
+import { logging } from '@superset-ui/core';
 
 import ExploreChartPanel from './ExploreChartPanel';
 import ControlPanelsContainer from './ControlPanelsContainer';
@@ -247,8 +248,7 @@ class ExploreViewContainer extends React.Component {
         history.pushState(payload, title, longUrl);
       }
     } catch (e) {
-      // eslint-disable-next-line no-console
-      console.warn(
+      logging.warn(
         'Failed at altering browser history',
         payload,
         title,
diff --git a/superset-frontend/src/explore/components/controls/AdhocFilterControl.jsx b/superset-frontend/src/explore/components/controls/AdhocFilterControl.jsx
index 08c294f..c3fde32 100644
--- a/superset-frontend/src/explore/components/controls/AdhocFilterControl.jsx
+++ b/superset-frontend/src/explore/components/controls/AdhocFilterControl.jsx
@@ -21,6 +21,7 @@ import PropTypes from 'prop-types';
 
 import { t } from '@superset-ui/translation';
 import { SupersetClient } from '@superset-ui/connection';
+import { logging } from '@superset-ui/core';
 
 import OnPasteSelect from 'src/components/Select/OnPasteSelect';
 
@@ -127,8 +128,7 @@ export default class AdhocFilterControl extends React.Component {
             }
           })
           .catch(error => {
-            /* eslint-disable no-debugger, no-console */
-            console.error('fetch extra_table_metadata:', error.statusText);
+            logging.error('fetch extra_table_metadata:', error.statusText);
           });
       }
     }
diff --git a/superset-frontend/src/explore/components/controls/withVerification.jsx b/superset-frontend/src/explore/components/controls/withVerification.jsx
index d17b4ce..1ca3c28 100644
--- a/superset-frontend/src/explore/components/controls/withVerification.jsx
+++ b/superset-frontend/src/explore/components/controls/withVerification.jsx
@@ -18,6 +18,7 @@
  */
 import React from 'react';
 import { SupersetClient } from '@superset-ui/connection';
+import { logging } from '@superset-ui/core';
 
 import { isEqual } from 'lodash';
 
@@ -67,7 +68,7 @@ export default function withVerification(
               this.setState({ validOptions: new Set(json) || new Set() });
             }
           })
-          .catch(error => console.log(error));
+          .catch(error => logging.log(error));
 
         if (!this.state.hasRunVerification) {
           this.setState({ hasRunVerification: true });
diff --git a/superset-frontend/src/setup/setupClient.js b/superset-frontend/src/setup/setupClient.js
index 35e7e75..990ae55 100644
--- a/superset-frontend/src/setup/setupClient.js
+++ b/superset-frontend/src/setup/setupClient.js
@@ -16,9 +16,9 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-/* eslint no-console: 0 */
 import { SupersetClient } from '@superset-ui/connection';
 import parseCookie from 'src/utils/parseCookie';
+import { logging } from '@superset-ui/core';
 
 export default function setupClient() {
   const csrfNode = document.querySelector('#csrf_token');
@@ -34,6 +34,6 @@ export default function setupClient() {
   })
     .init()
     .catch(error => {
-      console.warn('Error initializing SupersetClient', error);
+      logging.warn('Error initializing SupersetClient', error);
     });
 }
diff --git a/superset-frontend/src/views/CRUD/utils.tsx b/superset-frontend/src/views/CRUD/utils.tsx
index bfa6cff..884a764 100644
--- a/superset-frontend/src/views/CRUD/utils.tsx
+++ b/superset-frontend/src/views/CRUD/utils.tsx
@@ -56,7 +56,7 @@ export const createFetchRelated = (
 export function createErrorHandler(handleErrorFunc: (errMsg?: string) => void) {
   return async (e: SupersetClientResponse | string) => {
     const parsedError = await getClientErrorObject(e);
-    console.error(e); // eslint-disable-line no-console
+    console.error(e);
     handleErrorFunc(parsedError.message);
   };
 }