Skip to content

Commit 1391575

Browse files
authored
Chore: Removes some unneeded console logging and changes logs to errors (grafana#26235)
1 parent 718d6fb commit 1391575

File tree

51 files changed

+45
-77
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+45
-77
lines changed

packages/grafana-data/src/dataframe/ArrowDataFrame.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function arrowTableToDataFrame(table: Table): ArrowDataFrame {
7575
break;
7676
}
7777
default:
78-
console.log('UNKNOWN Type:', schema);
78+
console.error('UNKNOWN Type:', schema);
7979
}
8080

8181
fields.push({

packages/grafana-data/src/text/sanitize.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function sanitize(unsanitizedString: string): string {
2222
try {
2323
return sanitizeXSS.process(unsanitizedString);
2424
} catch (error) {
25-
console.log('String could not be sanitized', unsanitizedString);
25+
console.error('String could not be sanitized', unsanitizedString);
2626
return unsanitizedString;
2727
}
2828
}

packages/grafana-data/src/transformations/matchers/nameMatcher.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const patternToRegex = (pattern?: string): RegExp | undefined => {
9999
try {
100100
return stringToJsRegex(pattern);
101101
} catch (error) {
102-
console.log(error);
102+
console.error(error);
103103
return undefined;
104104
}
105105
};

packages/grafana-ui/src/components/Gauge/Gauge.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class Gauge extends PureComponent<Props> {
180180
try {
181181
$.plot(this.canvasElement, [plotSeries], options);
182182
} catch (err) {
183-
console.log('Gauge rendering error', err, options, value);
183+
console.error('Gauge rendering error', err, options, value);
184184
}
185185
}
186186

packages/grafana-ui/src/components/Graph/Graph.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ export class Graph extends PureComponent<GraphProps, GraphState> {
355355
flotOptions
356356
);
357357
} catch (err) {
358-
console.log('Graph rendering error', err, flotOptions, series);
358+
console.error('Graph rendering error', err, flotOptions, series);
359359
throw new Error('Error rendering panel');
360360
}
361361
}

packages/grafana-ui/src/components/Monaco/CodeEditor.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class UnthemedCodeEditor extends React.PureComponent<Props> {
1313

1414
componentWillUnmount() {
1515
if (this.completionCancel) {
16-
console.log('dispose of the custom completion stuff');
1716
this.completionCancel.dispose();
1817
}
1918
}

packages/grafana-ui/src/components/TableInputCSV/TableInputCSV.story.internal.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export const basic = () => {
1818
height={'90vh'}
1919
text={'a,b,c\n1,2,3'}
2020
onSeriesParsed={(data: DataFrame[], text: string) => {
21-
console.log('Data', data, text);
2221
action('Data')(data, text);
2322
}}
2423
/>

packages/jaeger-ui-components/src/common/UiFindInput.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ export default class UiFindInput extends React.PureComponent<Props> {
3838
this.props.onChange('');
3939
};
4040

41-
componentWillUnmount(): void {
42-
console.log('unomuet');
43-
}
44-
4541
render() {
4642
const { allowClear, inputProps, value } = this.props;
4743

public/app/core/components/Login/LoginCtrl.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class LoginCtrl extends PureComponent<Props, State> {
6969
.then(() => {
7070
this.toGrafana();
7171
})
72-
.catch((err: any) => console.log(err));
72+
.catch((err: any) => console.error(err));
7373
}
7474

7575
const resetModel = {

public/app/core/components/TransformersUI/FilterByNameTransformerEditor.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class FilterByNameTransformerEditor extends React.PureComponent<
8585
}
8686
}
8787
} catch (error) {
88-
console.log(error);
88+
console.error(error);
8989
}
9090
}
9191

public/app/core/components/scroll/scroll.ts

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export function geminiScrollbar() {
1919
let scrollRoot = elem.parent();
2020
const scroller = elem;
2121

22-
console.log('scroll');
2322
if (attrs.grafanaScrollbar && attrs.grafanaScrollbar === 'scrollonroot') {
2423
scrollRoot = scroller;
2524
}

public/app/core/controllers/signup_ctrl.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class SignUpCtrl {
1515

1616
// validate email is semi ok
1717
if (params.email && !params.email.match(/^\S+@\S+$/)) {
18-
console.log('invalid email');
18+
console.error('invalid email');
1919
return;
2020
}
2121

public/app/core/live/live_srv.ts

+1-10
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ export class LiveSrv {
2727
}
2828

2929
this.initPromise = new Promise((resolve, reject) => {
30-
console.log('Live: connecting...');
3130
this.conn = new WebSocket(this.getWebSocketUrl());
3231

3332
this.conn.onclose = (evt: any) => {
34-
console.log('Live: websocket onclose', evt);
3533
reject({ message: 'Connection closed' });
3634

3735
this.initPromise = null;
@@ -45,11 +43,9 @@ export class LiveSrv {
4543
this.conn.onerror = (evt: any) => {
4644
this.initPromise = null;
4745
reject({ message: 'Connection error' });
48-
console.log('Live: websocket error', evt);
4946
};
5047

5148
this.conn.onopen = (evt: any) => {
52-
console.log('opened');
5349
this.initPromise = null;
5450
resolve(this.conn);
5551
};
@@ -62,7 +58,7 @@ export class LiveSrv {
6258
message = JSON.parse(message);
6359

6460
if (!message.stream) {
65-
console.log('Error: stream message without stream!', message);
61+
console.error('Error: stream message without stream!', message);
6662
return;
6763
}
6864

@@ -81,8 +77,6 @@ export class LiveSrv {
8177
return;
8278
}
8379

84-
console.log('LiveSrv: Reconnecting');
85-
8680
this.getConnection().then((conn: any) => {
8781
_.each(this.observers, (value, key) => {
8882
this.send({ action: 'subscribe', stream: key });
@@ -103,7 +97,6 @@ export class LiveSrv {
10397
}
10498

10599
removeObserver(stream: any, observer: any) {
106-
console.log('unsubscribe', stream);
107100
delete this.observers[stream];
108101

109102
this.getConnection().then((conn: any) => {
@@ -112,8 +105,6 @@ export class LiveSrv {
112105
}
113106

114107
subscribe(streamName: string) {
115-
console.log('LiveSrv.subscribe: ' + streamName);
116-
117108
return Observable.create((observer: any) => {
118109
this.addObserver(streamName, observer);
119110

public/app/core/services/alert_srv.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export class AlertSrv {
44
constructor() {}
55

66
set() {
7-
console.log('old depricated alert srv being used');
7+
console.warn('old deprecated alert srv being used');
88
}
99
}
1010

public/app/core/services/bridge_srv.ts

-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ export class BridgeSrv {
8080
this.$location.replace();
8181
}
8282
});
83-
84-
console.log('store updating angular $location.url', url);
8583
}
8684

8785
// Check for template variable changes on a dashboard

public/app/core/services/echo/backends/PerformanceBackend.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class PerformanceBackend implements EchoBackend<PerformanceEvent, Perform
3434
metrics: this.buffer,
3535
};
3636

37-
// Currently we don have API for sending the metrics hence loging to console in dev environment
37+
// Currently we don't have an API for sending the metrics hence logging to console in dev environment
3838
if (process.env.NODE_ENV === 'development') {
3939
console.log('PerformanceBackend flushing:', result);
4040
}

public/app/core/utils/UserProvider.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export class UserProvider extends PureComponent<Props, State> {
172172
await getBackendSrv()
173173
.put('/api/user', payload)
174174
.then(this.loadUser)
175-
.catch(e => console.log(e))
175+
.catch(e => console.error(e))
176176
.finally(() => {
177177
this.setState({ loadingStates: { ...this.state.loadingStates, updateUserProfile: false } });
178178
});

public/app/core/utils/emitter.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class Emitter {
2323
emit<T>(event: AppEvent<T>, payload: T): void;
2424
emit<T>(event: AppEvent<T> | string, payload?: T | any): void {
2525
if (typeof event === 'string') {
26-
console.log(`Using strings as events is deprecated and will be removed in a future version. (${event})`);
26+
console.warn(`Using strings as events is deprecated and will be removed in a future version. (${event})`);
2727
this.emitter.emit(event, payload);
2828
} else {
2929
this.emitter.emit(event.name, payload);
@@ -47,7 +47,7 @@ export class Emitter {
4747
on<T>(event: AppEvent<T>, handler: (payload: T) => void, scope?: any): void;
4848
on<T>(event: AppEvent<T> | string, handler: (payload?: T | any) => void, scope?: any) {
4949
if (typeof event === 'string') {
50-
console.log(`Using strings as events is deprecated and will be removed in a future version. (${event})`);
50+
console.warn(`Using strings as events is deprecated and will be removed in a future version. (${event})`);
5151
this.emitter.on(event, handler);
5252

5353
if (scope) {
@@ -83,7 +83,7 @@ export class Emitter {
8383
off<T>(event: AppEvent<T>, handler: (payload: T) => void): void;
8484
off<T>(event: AppEvent<T> | string, handler: (payload?: T | any) => void) {
8585
if (typeof event === 'string') {
86-
console.log(`Using strings as events is deprecated and will be removed in a future version. (${event})`);
86+
console.warn(`Using strings as events is deprecated and will be removed in a future version. (${event})`);
8787
this.emitter.off(event, handler);
8888
return;
8989
}

public/app/features/admin/ldap/LdapSyncInfo.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export class LdapSyncInfo extends PureComponent<Props, State> {
1919
};
2020

2121
handleSyncClick = () => {
22-
console.log('Bulk-sync now');
2322
this.setState({ isSyncing: !this.state.isSyncing });
2423
};
2524

public/app/features/admin/state/actions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function loadAdminUserPage(userId: number): ThunkResult<void> {
3737
}
3838
dispatch(userAdminPageLoadedAction(true));
3939
} catch (error) {
40-
console.log(error);
40+
console.error(error);
4141

4242
const userError = {
4343
title: error.data.message,

public/app/features/annotations/annotations_srv.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class AnnotationsSrv {
6262
if (!err.message && err.data && err.data.message) {
6363
err.message = err.data.message;
6464
}
65-
console.log('AnnotationSrv.query error', err);
65+
console.error('AnnotationSrv.query error', err);
6666
appEvents.emit(AppEvents.alertError, ['Annotation Query Failed', err.message || err]);
6767
return [];
6868
});

public/app/features/dashboard/components/DashExportModal/DashboardExporter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export class DashboardExporter {
204204
return newObj;
205205
})
206206
.catch(err => {
207-
console.log('Export failed:', err);
207+
console.error('Export failed:', err);
208208
return {
209209
error: err,
210210
};

public/app/features/dashboard/components/Inspector/InspectJSONTab.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class InspectJSONTab extends PureComponent<Props, State> {
109109
appEvents.emit(AppEvents.alertSuccess, ['Panel model updated']);
110110
}
111111
} catch (err) {
112-
console.log('Error applyign updates', err);
112+
console.error('Error applying updates', err);
113113
appEvents.emit(AppEvents.alertError, ['Invalid JSON text']);
114114
}
115115

public/app/features/dashboard/dashgrid/PanelChrome.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ export class PanelChrome extends PureComponent<Props, State> {
171171
onRefresh = () => {
172172
const { panel, isInView, width } = this.props;
173173
if (!isInView) {
174-
console.log('Refresh when panel is visible', panel.id);
175174
this.setState({ refreshWhenInView: true });
176175
return;
177176
}
@@ -181,7 +180,6 @@ export class PanelChrome extends PureComponent<Props, State> {
181180
// Issue Query
182181
if (this.wantsQueryExecution) {
183182
if (width < 0) {
184-
console.log('Refresh skippted, no width yet... wait till we know');
185183
return;
186184
}
187185

public/app/features/dashboard/services/DashboardLoaderSrv.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export class DashboardLoaderSrv {
9090
};
9191
},
9292
(err: any) => {
93-
console.log('Script dashboard error ' + err);
93+
console.error('Script dashboard error ' + err);
9494
this.$rootScope.appEvent(AppEvents.alertError, [
9595
'Script Error',
9696
'Please make sure it exists and returns a valid dashboard',

public/app/features/dashboard/state/PanelQueryRunner.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export class PanelQueryRunner {
177177

178178
this.pipeToSubject(runRequest(ds, request));
179179
} catch (err) {
180-
console.log('PanelQueryRunner Error', err);
180+
console.error('PanelQueryRunner Error', err);
181181
}
182182
}
183183

public/app/features/dashboard/state/initDashboard.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ async function fetchDashboard(
117117
}
118118
} catch (err) {
119119
dispatch(dashboardInitFailed({ message: 'Failed to fetch dashboard', error: err }));
120-
console.log(err);
120+
console.error(err);
121121
return null;
122122
}
123123
}
@@ -161,7 +161,7 @@ export function initDashboard(args: InitDashboardArgs): ThunkResult<void> {
161161
dashboard = new DashboardModel(dashDTO.dashboard, dashDTO.meta);
162162
} catch (err) {
163163
dispatch(dashboardInitFailed({ message: 'Failed create dashboard model', error: err }));
164-
console.log(err);
164+
console.error(err);
165165
return;
166166
}
167167

@@ -216,7 +216,7 @@ export function initDashboard(args: InitDashboardArgs): ThunkResult<void> {
216216
keybindingSrv.setupDashboardBindings(args.$scope, dashboard);
217217
} catch (err) {
218218
dispatch(notifyApp(createErrorNotification('Dashboard init failed', err)));
219-
console.log(err);
219+
console.error(err);
220220
}
221221

222222
if (storeState.dashboard.modifiedQueries) {

public/app/features/dashboard/state/runRequest.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function runRequest(datasource: DataSourceApi, request: DataQueryRequest)
116116
}),
117117
// handle errors
118118
catchError(err => {
119-
console.log('runRequest.catchError', err);
119+
console.error('runRequest.catchError', err);
120120
return of({
121121
...state.panelData,
122122
state: LoadingState.Error,

public/app/features/dashboard/utils/panel.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const refreshPanel = (panel: PanelModel) => {
6666
};
6767

6868
export const toggleLegend = (panel: PanelModel) => {
69-
console.log('Toggle legend is not implemented yet');
69+
console.warn('Toggle legend is not implemented yet');
7070
// We need to set panel.legend defaults first
7171
// panel.legend.show = !panel.legend.show;
7272
refreshPanel(panel);

public/app/features/datasources/state/actions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const initDataSourceSettings = (
6767

6868
dispatch(initDataSourceSettingsSucceeded(importedPlugin));
6969
} catch (err) {
70-
console.log('Failed to import plugin module', err);
70+
console.error('Failed to import plugin module', err);
7171
dispatch(initDataSourceSettingsFailed(err));
7272
}
7373
};

public/app/features/explore/QueryRow.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ export class QueryRow extends PureComponent<QueryRowProps, QueryRowState> {
7676
}
7777
};
7878

79-
componentWillUnmount() {
80-
console.log('QueryRow will unmount');
81-
}
82-
8379
onClickToggleDisabled = () => {
8480
const { exploreId, index, query } = this.props;
8581
const newQuery = {

public/app/features/explore/state/actions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ export const loadDatasource = (exploreId: ExploreId, instance: DataSourceApi, or
372372
try {
373373
instance.init();
374374
} catch (err) {
375-
console.log(err);
375+
console.error(err);
376376
}
377377
}
378378

public/app/features/manage-dashboards/components/UploadDashboard/uploadDashboardDirective.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function uploadDashboardDirective(timer: any, $location: ILocationService
3030
try {
3131
dash = JSON.parse(e.target.result);
3232
} catch (err) {
33-
console.log(err);
33+
console.error(err);
3434
appEvents.emit(AppEvents.alertError, [
3535
'Import failed',
3636
'JSON -> JS Serialization failed: ' + err.message,

public/app/features/plugins/plugin_component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ function pluginDirectiveLoader(
266266
registerPluginComponent(scope, elem, attrs, componentInfo);
267267
})
268268
.catch((err: any) => {
269-
console.log('Plugin component error', err);
269+
console.error('Plugin component error', err);
270270
});
271271
},
272272
};

0 commit comments

Comments
 (0)