From 85a81af1daff6b45c6d3e1cb621e42b2f5967c35 Mon Sep 17 00:00:00 2001 From: Dariusz Niemczyk Date: Fri, 15 Oct 2021 17:00:43 +0200 Subject: [PATCH] Replace console.warn with logger.warn Related https://github.com/vector-im/element-web/issues/18425 --- src/vector/app.tsx | 6 +++--- src/vector/init.tsx | 2 +- src/vector/jitsi/index.ts | 6 +++--- src/vector/platform/ElectronPlatform.tsx | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/vector/app.tsx b/src/vector/app.tsx index fc168cb117..8cd86de046 100644 --- a/src/vector/app.tsx +++ b/src/vector/app.tsx @@ -222,7 +222,7 @@ async function verifyServerConfig() { if (hsUrl) { logger.log("Config uses a default_hs_url - constructing a default_server_config using this information"); - console.warn( + logger.warn( "DEPRECATED CONFIG OPTION: In the future, default_hs_url will not be accepted. Please use " + "default_server_config instead.", ); @@ -247,7 +247,7 @@ async function verifyServerConfig() { if (serverName) { logger.log("Config uses a default_server_name - doing .well-known lookup"); - console.warn( + logger.warn( "DEPRECATED CONFIG OPTION: In the future, default_server_name will not be accepted. Please " + "use default_server_config instead.", ); @@ -259,7 +259,7 @@ async function verifyServerConfig() { const { hsUrl, isUrl, userId } = await Lifecycle.getStoredSessionVars(); if (hsUrl && userId) { logger.error(e); - console.warn("A session was found - suppressing config error and using the session's homeserver"); + logger.warn("A session was found - suppressing config error and using the session's homeserver"); logger.log("Using pre-existing hsUrl and isUrl: ", { hsUrl, isUrl }); validatedConfig = await AutoDiscoveryUtils.validateServerConfigWithStaticUrls(hsUrl, isUrl, true); diff --git a/src/vector/init.tsx b/src/vector/init.tsx index 9ad9787dd6..bf30b6d8ac 100644 --- a/src/vector/init.tsx +++ b/src/vector/init.tsx @@ -56,7 +56,7 @@ export function setupLogStorage() { if (SdkConfig.get().bug_report_endpoint_url) { return initRageshakeStore(); } - console.warn("No bug report endpoint set - logs will not be persisted"); + logger.warn("No bug report endpoint set - logs will not be persisted"); return Promise.resolve(); } diff --git a/src/vector/jitsi/index.ts b/src/vector/jitsi/index.ts index e0fbeb8d75..763c96ef7c 100644 --- a/src/vector/jitsi/index.ts +++ b/src/vector/jitsi/index.ts @@ -96,7 +96,7 @@ let meetApi: any; // JitsiMeetExternalAPI ]); widgetApi.start(); } else { - console.warn("No parent URL or no widget ID - assuming no widget API is available"); + logger.warn("No parent URL or no widget ID - assuming no widget API is available"); } // Populate the Jitsi params now @@ -208,7 +208,7 @@ function joinConference() { // event handler bound in HTML if (jitsiAuth === JITSI_OPENIDTOKEN_JWT_AUTH) { if (!openIdToken?.access_token) { // eslint-disable-line camelcase // We've failing to get a token, don't try to init conference - console.warn('Expected to have an OpenID credential, cannot initialize widget.'); + logger.warn('Expected to have an OpenID credential, cannot initialize widget.'); document.getElementById("widgetActionContainer").innerText = "Failed to load Jitsi widget"; return; } @@ -223,7 +223,7 @@ function joinConference() { // event handler bound in HTML widgetApi.setAlwaysOnScreen(true); } - console.warn( + logger.warn( "[Jitsi Widget] The next few errors about failing to parse URL parameters are fine if " + "they mention 'external_api' or 'jitsi' in the stack. They're just Jitsi Meet trying to parse " + "our fragment values and not recognizing the options.", diff --git a/src/vector/platform/ElectronPlatform.tsx b/src/vector/platform/ElectronPlatform.tsx index 1e416f4636..b8f229db30 100644 --- a/src/vector/platform/ElectronPlatform.tsx +++ b/src/vector/platform/ElectronPlatform.tsx @@ -126,12 +126,12 @@ class SeshatIndexManager extends BaseEventIndexManager { private onIpcReply = (ev: {}, payload: IPCPayload) => { if (payload.id === undefined) { - console.warn("Ignoring IPC reply with no ID"); + logger.warn("Ignoring IPC reply with no ID"); return; } if (this.pendingIpcCalls[payload.id] === undefined) { - console.warn("Unknown IPC payload ID: " + payload.id); + logger.warn("Unknown IPC payload ID: " + payload.id); return; } @@ -505,12 +505,12 @@ export default class ElectronPlatform extends VectorBasePlatform { private onIpcReply = (ev, payload) => { if (payload.id === undefined) { - console.warn("Ignoring IPC reply with no ID"); + logger.warn("Ignoring IPC reply with no ID"); return; } if (this.pendingIpcCalls[payload.id] === undefined) { - console.warn("Unknown IPC payload ID: " + payload.id); + logger.warn("Unknown IPC payload ID: " + payload.id); return; }