Replace console.error with logger.error

Related https://github.com/vector-im/element-web/issues/18425
This commit is contained in:
Dariusz Niemczyk 2021-10-15 16:30:53 +02:00 committed by Dariusz Niemczyk
parent 9c594a8a96
commit 5e73a212f4
124 changed files with 417 additions and 250 deletions

View file

@ -324,7 +324,7 @@ export default class AppTile extends React.Component<IProps, IState> {
// Fetch a token for the integration manager, now that we're allowed to
this.startWidget();
}).catch(err => {
console.error(err);
logger.error(err);
// We don't really need to do anything about this - the user will just hit the button again.
});
};

View file

@ -25,6 +25,8 @@ import { replaceableComponent } from "../../../utils/replaceableComponent";
import BugReportDialog from '../dialogs/BugReportDialog';
import AccessibleButton from './AccessibleButton';
import { logger } from "matrix-js-sdk/src/logger";
interface IState {
error: Error;
}
@ -52,8 +54,8 @@ export default class ErrorBoundary extends React.PureComponent<{}, IState> {
componentDidCatch(error: Error, { componentStack }: ErrorInfo): void {
// Browser consoles are better at formatting output when native errors are passed
// in their own `console.error` invocation.
console.error(error);
console.error(
logger.error(error);
logger.error(
"The above error occured while React was rendering the following components:",
componentStack,
);

View file

@ -22,6 +22,8 @@ import MatrixClientContext from "../../../contexts/MatrixClientContext";
import { replaceableComponent } from "../../../utils/replaceableComponent";
import { mediaFromMxc } from "../../../customisations/Media";
import { logger } from "matrix-js-sdk/src/logger";
class FlairAvatar extends React.Component {
constructor() {
super();
@ -92,7 +94,7 @@ export default class Flair extends React.Component {
try {
groupProfile = await FlairStore.getGroupProfileCached(this.context, groupId);
} catch (err) {
console.error('Could not get profile for group', groupId, err);
logger.error('Could not get profile for group', groupId, err);
}
profiles.push(groupProfile);
}

View file

@ -29,6 +29,8 @@ import { mediaFromMxc } from "../../../customisations/Media";
import Tooltip from './Tooltip';
import { replaceableComponent } from "../../../utils/replaceableComponent";
import { logger } from "matrix-js-sdk/src/logger";
@replaceableComponent("views.elements.Pill")
class Pill extends React.Component {
static roomNotifPos(text) {
@ -188,7 +190,7 @@ class Pill extends React.Component {
};
this.setState({ member });
}).catch((err) => {
console.error('Could not retrieve profile data for ' + userId + ':', err);
logger.error('Could not retrieve profile data for ' + userId + ':', err);
});
}