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

@ -176,7 +176,7 @@ const CreateSpaceFromCommunityDialog: React.FC<IProps> = ({ matrixClient: cli, g
const { servers } = await cli.getRoomIdForAlias(canonicalAlias);
viaMap.set(roomId, servers);
} catch (e) {
console.warn("Failed to resolve alias during community migration", e);
logger.warn("Failed to resolve alias during community migration", e);
}
}
@ -221,7 +221,7 @@ const CreateSpaceFromCommunityDialog: React.FC<IProps> = ({ matrixClient: cli, g
_t("This community has been upgraded into a Space") + `</h1></a><br />`
+ groupSummary.profile.long_description,
} as IGroupSummary["profile"]).catch(e => {
console.warn("Failed to update community profile during migration", e);
logger.warn("Failed to update community profile during migration", e);
});
onFinished(roomId);

View file

@ -158,7 +158,7 @@ export default class DeactivateAccountDialog extends React.Component<IProps, ISt
// Our application lifecycle will catch the error and do the logout bits.
// We'll try to log something in an vain attempt to record what happened (storage
// is also obliterated on logout).
console.warn("User's account got deactivated without confirmation: Server had no auth");
logger.warn("User's account got deactivated without confirmation: Server had no auth");
this.setState({ errStr: _t("Server did not require any authentication") });
}).catch(e => {
if (e && e.httpStatus === 401 && e.data) {

View file

@ -991,7 +991,7 @@ class SettingsExplorer extends React.PureComponent<IExplorerProps, ISettingsExpl
const val = parsedExplicit[level];
await SettingsStore.setValue(settingId, null, level as SettingLevel, val);
} catch (e) {
console.warn(e);
logger.warn(e);
}
}
const roomId = this.props.room.roomId;
@ -1001,7 +1001,7 @@ class SettingsExplorer extends React.PureComponent<IExplorerProps, ISettingsExpl
const val = parsedExplicitRoom[level];
await SettingsStore.setValue(settingId, roomId, level as SettingLevel, val);
} catch (e) {
console.warn(e);
logger.warn(e);
}
}
this.setState({
@ -1035,7 +1035,7 @@ class SettingsExplorer extends React.PureComponent<IExplorerProps, ISettingsExpl
vals[level] = null;
}
} catch (e) {
console.warn(e);
logger.warn(e);
}
}
return JSON.stringify(vals, null, 4);

View file

@ -33,6 +33,8 @@ import {
} from "./HostSignupDialogTypes";
import { replaceableComponent } from "../../../utils/replaceableComponent";
import { logger } from "matrix-js-sdk/src/logger";
const HOST_SIGNUP_KEY = "host_signup";
interface IProps {}
@ -146,7 +148,7 @@ export default class HostSignupDialog extends React.PureComponent<IProps, IState
private async sendAccountDetails() {
const openIdToken = await MatrixClientPeg.get().getOpenIdToken();
if (!openIdToken || !openIdToken.access_token) {
console.warn("Failed to connect to homeserver for OpenID token.");
logger.warn("Failed to connect to homeserver for OpenID token.");
this.setState({
completed: true,
error: _t("Failed to connect to your homeserver. Please close this dialog and try again."),

View file

@ -470,7 +470,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
for (const member of otherMembers) {
if (rooms[member.userId]) continue; // already have a room
console.warn(`Adding DM room for ${member.userId} as ${dmRoom.roomId} from tag, not DM map`);
logger.warn(`Adding DM room for ${member.userId} as ${dmRoom.roomId} from tag, not DM map`);
rooms[member.userId] = dmRoom;
}
}
@ -479,7 +479,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
for (const userId in rooms) {
// Filter out user IDs that are already in the room / should be excluded
if (excludedTargetIds.has(userId)) {
console.warn(`[Invite:Recents] Excluding ${userId} from recents`);
logger.warn(`[Invite:Recents] Excluding ${userId} from recents`);
continue;
}
@ -487,7 +487,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
const member = room.getMember(userId);
if (!member) {
// just skip people who don't have memberships for some reason
console.warn(`[Invite:Recents] ${userId} is missing a member object in their own DM (${room.roomId})`);
logger.warn(`[Invite:Recents] ${userId} is missing a member object in their own DM (${room.roomId})`);
continue;
}
@ -507,13 +507,13 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
}
if (!lastEventTs) {
// something weird is going on with this room
console.warn(`[Invite:Recents] ${userId} (${room.roomId}) has a weird last timestamp: ${lastEventTs}`);
logger.warn(`[Invite:Recents] ${userId} (${room.roomId}) has a weird last timestamp: ${lastEventTs}`);
continue;
}
recents.push({ userId, user: member, lastActive: lastEventTs });
}
if (!recents) console.warn("[Invite:Recents] No recents to suggest!");
if (!recents) logger.warn("[Invite:Recents] No recents to suggest!");
// Sort the recents by last active to save us time later
recents.sort((a, b) => b.lastActive - a.lastActive);
@ -873,8 +873,8 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
});
}
} catch (e) {
console.warn("Non-fatal error trying to make an invite for a user ID");
console.warn(e);
logger.warn("Non-fatal error trying to make an invite for a user ID");
logger.warn(e);
// Add a result anyways, just without a profile. We stick it at the
// top so it is most obviously presented to the user.