Expose logger instance for development purposes

Related https://github.com/vector-im/element-web/issues/18425
This commit is contained in:
Dariusz Niemczyk 2021-10-15 17:04:34 +02:00 committed by Dariusz Niemczyk
parent 85a81af1da
commit e6993ca964
2 changed files with 5 additions and 2 deletions

View file

@ -16,6 +16,7 @@ limitations under the License.
import "matrix-react-sdk/src/@types/global"; // load matrix-react-sdk's type extensions first import "matrix-react-sdk/src/@types/global"; // load matrix-react-sdk's type extensions first
import type { Renderer } from "react-dom"; import type { Renderer } from "react-dom";
import type { logger } from "matrix-js-sdk/src/logger";
type ElectronChannel = type ElectronChannel =
"app_onAction" | "app_onAction" |
@ -36,6 +37,7 @@ type ElectronChannel =
declare global { declare global {
interface Window { interface Window {
mxSendRageshake: (text: string, withLogs?: boolean) => void; mxSendRageshake: (text: string, withLogs?: boolean) => void;
matrixLogger: typeof logger;
matrixChat: ReturnType<Renderer>; matrixChat: ReturnType<Renderer>;
// electron-only // electron-only

View file

@ -31,17 +31,18 @@ import { AutoDiscovery } from "matrix-js-sdk/src/autodiscovery";
import * as Lifecycle from "matrix-react-sdk/src/Lifecycle"; import * as Lifecycle from "matrix-react-sdk/src/Lifecycle";
import type MatrixChatType from "matrix-react-sdk/src/components/structures/MatrixChat"; import type MatrixChatType from "matrix-react-sdk/src/components/structures/MatrixChat";
import SdkConfig from "matrix-react-sdk/src/SdkConfig"; import SdkConfig from "matrix-react-sdk/src/SdkConfig";
import { logger } from "matrix-js-sdk/src/logger";
import { parseQs, parseQsFromFragment } from './url_utils'; import { parseQs, parseQsFromFragment } from './url_utils';
import VectorBasePlatform from "./platform/VectorBasePlatform"; import VectorBasePlatform from "./platform/VectorBasePlatform";
import { createClient } from "matrix-js-sdk/src/matrix"; import { createClient } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
let lastLocationHashSet: string = null; let lastLocationHashSet: string = null;
logger.log(`Application is running in ${process.env.NODE_ENV} mode`); logger.log(`Application is running in ${process.env.NODE_ENV} mode`);
window.matrixLogger = logger;
// Parse the given window.location and return parameters that can be used when calling // Parse the given window.location and return parameters that can be used when calling
// MatrixChat.showScreen(screen, params) // MatrixChat.showScreen(screen, params)
function getScreenFromLocation(location: Location) { function getScreenFromLocation(location: Location) {