Fix missing js-sdk logging

Some of the js-sdk logging was going missing due to js-sdk's
loglevel library being initialised before the rageshake logging.

Fix by doing the rageshake setup within an import, as commented.
This commit is contained in:
David Baker 2018-11-22 16:21:55 +00:00
parent 8298e73205
commit 092ae7ef2f
2 changed files with 48 additions and 19 deletions

View file

@ -24,6 +24,8 @@ require('gfm.css/gfm.css');
require('highlight.js/styles/github.css');
require('draft-js/dist/Draft.css');
import './rageshakesetup';
import React from 'react';
// add React and ReactPerf to the global namespace, to make them easier to
// access via the console
@ -56,8 +58,6 @@ import SdkConfig from "matrix-react-sdk/lib/SdkConfig";
import Olm from 'olm';
import rageshake from "matrix-react-sdk/lib/rageshake/rageshake";
import CallHandler from 'matrix-react-sdk/lib/CallHandler';
import {getVectorConfig} from './getconfig';
@ -68,22 +68,6 @@ let lastLocationHashSet = null;
// and need to migrate, but they spam the console with warnings.
Promise.config({warnings: false});
function initRageshake() {
rageshake.init().then(() => {
console.log("Initialised rageshake: See https://bugs.chromium.org/p/chromium/issues/detail?id=583193 to fix line numbers on Chrome.");
window.addEventListener('beforeunload', (e) => {
console.log('riot-web closing');
// try to flush the logs to indexeddb
rageshake.flush();
});
rageshake.cleanup();
}, (err) => {
console.error("Failed to initialise rageshake: " + err);
});
}
function checkBrowserFeatures(featureList) {
if (!window.Modernizr) {
console.error("Cannot check features - Modernizr global is missing.");
@ -225,7 +209,6 @@ function onTokenLoginCompleted() {
}
async function loadApp() {
initRageshake();
MatrixClientPeg.setIndexedDbWorkerScript(window.vector_indexeddb_worker_script);
CallHandler.setConferenceHandler(VectorConferenceHandler);