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

@ -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.