Globally replace all console.logs via codemod (#6827)

This commit replaces all the `console.log` to `logger.log` via an automated script.
Related: vector-im/element-web#18425
This commit is contained in:
Dariusz Niemczyk 2021-09-21 17:48:09 +02:00 committed by GitHub
parent 3a548d4c9c
commit 2d1d42b90e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
81 changed files with 396 additions and 258 deletions

View file

@ -44,6 +44,8 @@ import { ActionPayload } from "../../../dispatcher/payloads";
import AccessibleButton from '../elements/AccessibleButton';
import SettingsStore from "../../../settings/SettingsStore";
import { logger } from "matrix-js-sdk/src/logger";
function getHtmlReplyFallback(mxEvent: MatrixEvent): string {
const html = mxEvent.getContent().formatted_body;
if (!html) {
@ -308,7 +310,7 @@ export default class EditMessageComposer extends React.Component<IProps, IState>
description: errText,
});
} else {
console.log("Command success.");
logger.log("Command success.");
if (messageContent) return messageContent;
}
}

View file

@ -56,6 +56,8 @@ import QuestionDialog from "../dialogs/QuestionDialog";
import { ActionPayload } from "../../../dispatcher/payloads";
import { decorateStartSendingTime, sendRoundTripMetric } from "../../../sendTimePerformanceMetrics";
import { logger } from "matrix-js-sdk/src/logger";
function addReplyToMessageContent(
content: IContent,
replyToEvent: MatrixEvent,
@ -341,7 +343,7 @@ export default class SendMessageComposer extends React.Component<IProps> {
description: errText,
});
} else {
console.log("Command success.");
logger.log("Command success.");
if (messageContent) return messageContent;
}
}

View file

@ -34,6 +34,8 @@ import ScalarAuthClient from '../../../ScalarAuthClient';
import GenericElementContextMenu from "../context_menus/GenericElementContextMenu";
import { IApp } from "../../../stores/WidgetStore";
import { logger } from "matrix-js-sdk/src/logger";
// This should be below the dialog level (4000), but above the rest of the UI (1000-2000).
// We sit in a context menu, so this should be given to the context menu.
const STICKERPICKER_Z_INDEX = 3500;
@ -99,11 +101,11 @@ export default class Stickerpicker extends React.PureComponent<IProps, IState> {
private removeStickerpickerWidgets = async (): Promise<void> => {
const scalarClient = await this.acquireScalarClient();
console.log('Removing Stickerpicker widgets');
logger.log('Removing Stickerpicker widgets');
if (this.state.widgetId) {
if (scalarClient) {
scalarClient.disableWidgetAssets(WidgetType.STICKERPICKER, this.state.widgetId).then(() => {
console.log('Assets disabled');
logger.log('Assets disabled');
}).catch((err) => {
console.error('Failed to disable assets');
});