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:
Dariusz Niemczyk 2021-09-21 17:48:09 +02:00 committed by GitHub
parent 3a548d4c9c
commit 2d1d42b90e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
81 changed files with 396 additions and 258 deletions

View file

@ -30,6 +30,8 @@ import SettingsStore from "../settings/SettingsStore";
import url from 'url';
import { compare } from "../utils/strings";
import { logger } from "matrix-js-sdk/src/logger";
const KIND_PREFERENCE = [
// Ordered: first is most preferred, last is least preferred.
Kind.Account,
@ -86,12 +88,12 @@ export class IntegrationManagers {
}
private setupHomeserverManagers = async (discoveryResponse) => {
console.log("Updating homeserver-configured integration managers...");
logger.log("Updating homeserver-configured integration managers...");
if (discoveryResponse && discoveryResponse['m.integrations']) {
let managers = discoveryResponse['m.integrations']['managers'];
if (!Array.isArray(managers)) managers = []; // make it an array so we can wipe the HS managers
console.log(`Homeserver has ${managers.length} integration managers`);
logger.log(`Homeserver has ${managers.length} integration managers`);
// Clear out any known managers for the homeserver
// TODO: Log out of the scalar clients
@ -109,7 +111,7 @@ export class IntegrationManagers {
this.primaryManager = null; // reset primary
} else {
console.log("Homeserver has no integration managers");
logger.log("Homeserver has no integration managers");
}
};
@ -211,7 +213,7 @@ export class IntegrationManagers {
* or null if none was found.
*/
async tryDiscoverManager(domainName: string): Promise<IntegrationManagerInstance> {
console.log("Looking up integration manager via .well-known");
logger.log("Looking up integration manager via .well-known");
if (domainName.startsWith("http:") || domainName.startsWith("https:")) {
// trim off the scheme and just use the domain
domainName = url.parse(domainName).host;
@ -240,7 +242,7 @@ export class IntegrationManagers {
// All discovered managers are per-user managers
const manager = new IntegrationManagerInstance(Kind.Account, widget["data"]["api_url"], widget["url"]);
console.log("Got an integration manager (untested)");
logger.log("Got an integration manager (untested)");
// We don't test the manager because the caller may need to do extra
// checks or similar with it. For instance, they may need to deal with