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:
parent
3a548d4c9c
commit
2d1d42b90e
81 changed files with 396 additions and 258 deletions
|
@ -16,6 +16,8 @@ limitations under the License.
|
|||
|
||||
import EventEmitter from 'events';
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
const BULK_REQUEST_DEBOUNCE_MS = 200;
|
||||
|
||||
// Does the server support groups? Assume yes until we receive M_UNRECOGNIZED.
|
||||
|
@ -186,14 +188,14 @@ class FlairStore extends EventEmitter {
|
|||
}
|
||||
|
||||
// No request yet, start one
|
||||
console.log('FlairStore: Request group profile of ' + groupId);
|
||||
logger.log('FlairStore: Request group profile of ' + groupId);
|
||||
this._groupProfilesPromise[groupId] = matrixClient.getGroupProfile(groupId);
|
||||
|
||||
let profile;
|
||||
try {
|
||||
profile = await this._groupProfilesPromise[groupId];
|
||||
} catch (e) {
|
||||
console.log('FlairStore: Failed to get group profile for ' + groupId, e);
|
||||
logger.log('FlairStore: Failed to get group profile for ' + groupId, e);
|
||||
// Don't retry, but allow a retry when the profile is next requested
|
||||
delete this._groupProfilesPromise[groupId];
|
||||
return null;
|
||||
|
@ -209,7 +211,7 @@ class FlairStore extends EventEmitter {
|
|||
|
||||
/// XXX: This is verging on recreating a third "Flux"-looking Store. We really
|
||||
/// should replace FlairStore with a Flux store and some async actions.
|
||||
console.log('FlairStore: Emit updateGroupProfile for ' + groupId);
|
||||
logger.log('FlairStore: Emit updateGroupProfile for ' + groupId);
|
||||
this.emit('updateGroupProfile');
|
||||
|
||||
setTimeout(() => {
|
||||
|
|
|
@ -31,6 +31,8 @@ import { Action } from "../dispatcher/actions";
|
|||
import { retry } from "../utils/promise";
|
||||
import CountlyAnalytics from "../CountlyAnalytics";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
const NUM_JOIN_RETRY = 5;
|
||||
|
||||
const INITIAL_STATE = {
|
||||
|
@ -319,7 +321,7 @@ class RoomViewStore extends Store<ActionPayload> {
|
|||
});
|
||||
const err = payload.err;
|
||||
let msg = err.message ? err.message : JSON.stringify(err);
|
||||
console.log("Failed to join room:", msg);
|
||||
logger.log("Failed to join room:", msg);
|
||||
|
||||
if (err.name === "ConnectionError") {
|
||||
msg = _t("There was an error joining the room");
|
||||
|
|
|
@ -23,6 +23,8 @@ import { PHASE_DONE as VERIF_PHASE_DONE } from "matrix-js-sdk/src/crypto/verific
|
|||
import { MatrixClientPeg } from '../MatrixClientPeg';
|
||||
import { accessSecretStorage, AccessCancelledError } from '../SecurityManager';
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
export enum Phase {
|
||||
Loading = 0,
|
||||
Intro = 1,
|
||||
|
@ -153,7 +155,7 @@ export class SetupEncryptionStore extends EventEmitter {
|
|||
}
|
||||
} catch (e) {
|
||||
if (!(e instanceof AccessCancelledError)) {
|
||||
console.log(e);
|
||||
logger.log(e);
|
||||
}
|
||||
// this will throw if the user hits cancel, so ignore
|
||||
this.phase = Phase.Intro;
|
||||
|
|
|
@ -28,6 +28,8 @@ import { WidgetType } from "../widgets/WidgetType";
|
|||
import { UPDATE_EVENT } from "./AsyncStore";
|
||||
import { MatrixClientPeg } from "../MatrixClientPeg";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IState {}
|
||||
|
||||
export interface IApp extends IWidget {
|
||||
|
@ -146,7 +148,7 @@ export default class WidgetStore extends AsyncStoreWithClient<IState> {
|
|||
ActiveWidgetStore.getRoomId(persistentWidgetId) === room.roomId &&
|
||||
!roomInfo.widgets.some(w => w.id === persistentWidgetId)
|
||||
) {
|
||||
console.log(`Persistent widget ${persistentWidgetId} removed from room ${room.roomId}: destroying.`);
|
||||
logger.log(`Persistent widget ${persistentWidgetId} removed from room ${room.roomId}: destroying.`);
|
||||
ActiveWidgetStore.destroyPersistentWidget(persistentWidgetId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ import SpaceStore from "../SpaceStore";
|
|||
import { Action } from "../../dispatcher/actions";
|
||||
import { SettingUpdatedPayload } from "../../dispatcher/payloads/SettingUpdatedPayload";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
interface IState {
|
||||
tagsEnabled?: boolean;
|
||||
}
|
||||
|
@ -129,7 +131,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
|
|||
|
||||
// Update any settings here, as some may have happened before we were logically ready.
|
||||
// Update any settings here, as some may have happened before we were logically ready.
|
||||
console.log("Regenerating room lists: Startup");
|
||||
logger.log("Regenerating room lists: Startup");
|
||||
await this.readAndCacheSettingsFromStore();
|
||||
this.regenerateAllLists({ trigger: false });
|
||||
this.handleRVSUpdate({ trigger: false }); // fake an RVS update to adjust sticky room, if needed
|
||||
|
@ -205,7 +207,7 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
|
|||
if (payload.action === Action.SettingUpdated) {
|
||||
const settingUpdatedPayload = payload as SettingUpdatedPayload;
|
||||
if (this.watchedSettings.includes(settingUpdatedPayload.settingName)) {
|
||||
console.log("Regenerating room lists: Settings changed");
|
||||
logger.log("Regenerating room lists: Settings changed");
|
||||
await this.readAndCacheSettingsFromStore();
|
||||
|
||||
this.regenerateAllLists({ trigger: false }); // regenerate the lists now
|
||||
|
|
|
@ -57,6 +57,8 @@ import { getUserLanguage } from "../../languageHandler";
|
|||
import { WidgetVariableCustomisations } from "../../customisations/WidgetVariables";
|
||||
import { arrayFastClone } from "../../utils/arrays";
|
||||
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
|
||||
// TODO: Destroy all of this code
|
||||
|
||||
interface IAppTileProps {
|
||||
|
@ -405,7 +407,7 @@ export class StopGapWidget extends EventEmitter {
|
|||
|
||||
public stop(opts = { forceDestroy: false }) {
|
||||
if (!opts?.forceDestroy && ActiveWidgetStore.getPersistentWidgetId() === this.mockWidget.id) {
|
||||
console.log("Skipping destroy - persistent widget");
|
||||
logger.log("Skipping destroy - persistent widget");
|
||||
return;
|
||||
}
|
||||
if (!this.started) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue