Replace console.warn with logger.warn

Related https://github.com/vector-im/element-web/issues/18425
This commit is contained in:
Dariusz Niemczyk 2021-10-15 16:31:29 +02:00 committed by Dariusz Niemczyk
parent 5e73a212f4
commit 5290afcc4c
71 changed files with 195 additions and 127 deletions

View file

@ -27,6 +27,8 @@ import MatrixClientContext from "../../contexts/MatrixClientContext";
import AutoHideScrollbar from "./AutoHideScrollbar";
import { ActionPayload } from "../../dispatcher/payloads";
import { logger } from "matrix-js-sdk/src/logger";
interface IProps {
// URL to request embedded page content from
url?: string;
@ -79,7 +81,7 @@ export default class EmbeddedPage extends React.PureComponent<IProps, IState> {
}
if (err || response.status < 200 || response.status >= 300) {
console.warn(`Error loading page: ${err}`);
logger.warn(`Error loading page: ${err}`);
this.setState({ page: _t("Couldn't load page") });
return;
}

View file

@ -917,7 +917,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
let waitFor = Promise.resolve(null);
if (!this.firstSyncComplete) {
if (!this.firstSyncPromise) {
console.warn('Cannot view a room before first sync. room_id:', roomInfo.room_id);
logger.warn('Cannot view a room before first sync. room_id:', roomInfo.room_id);
return;
}
waitFor = this.firstSyncPromise.promise;
@ -973,7 +973,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
// Wait for the first sync to complete
if (!this.firstSyncComplete) {
if (!this.firstSyncPromise) {
console.warn('Cannot view a group before first sync. group_id:', groupId);
logger.warn('Cannot view a group before first sync. group_id:', groupId);
return;
}
await this.firstSyncPromise.promise;
@ -1475,7 +1475,7 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
Modal.closeCurrentModal('Session.logged_out');
if (errObj.httpStatus === 401 && errObj.data && errObj.data['soft_logout']) {
console.warn("Soft logout issued by server - avoiding data deletion");
logger.warn("Soft logout issued by server - avoiding data deletion");
Lifecycle.softLogout();
return;
}

View file

@ -133,7 +133,7 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
}
this.setState({ protocolsLoading: false });
}, (err) => {
console.warn(`error loading third party protocols: ${err}`);
logger.warn(`error loading third party protocols: ${err}`);
this.setState({ protocolsLoading: false });
if (MatrixClientPeg.get().isGuest()) {
// Guests currently aren't allowed to use this API, so

View file

@ -312,7 +312,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
//
// for now, just warn about this. But we're going to end up paginating
// both rooms separately, and it's all bad.
console.warn("Replacing timelineSet on a TimelinePanel - confusion may ensue");
logger.warn("Replacing timelineSet on a TimelinePanel - confusion may ensue");
}
const differentEventId = newProps.eventId != this.props.eventId;
@ -1266,7 +1266,7 @@ class TimelinePanel extends React.Component<IProps, IState> {
// Somehow, it seems to be possible for live events to not have
// a timeline, even though that should not happen. :(
// https://github.com/vector-im/element-web/issues/12120
console.warn(
logger.warn(
`Event ${events[i].getId()} in room ${room.roomId} is live, ` +
`but it does not have a timeline`,
);