Merge remote-tracking branch 'origin/livekit' into raise-hand-button

This commit is contained in:
Half-Shot
2024-10-31 17:08:36 +00:00
50 changed files with 2359 additions and 2277 deletions

View File

@@ -467,6 +467,8 @@ declare global {
*/
export async function init(): Promise<void> {
global.mx_rage_logger = new ConsoleLogger();
// configure loglevel based loggers:
setLogExtension(logger, global.mx_rage_logger.log);
// these are the child/prefixed loggers we want to capture from js-sdk
// there doesn't seem to be an easy way to capture all children
@@ -474,6 +476,29 @@ export async function init(): Promise<void> {
setLogExtension(logger.getChild(loggerName), global.mx_rage_logger.log);
});
// intercept console logging so that we can get matrix_sdk logs:
// this is nasty, but no logging hooks are provided
[
"trace" as const,
"debug" as const,
"info" as const,
"warn" as const,
"error" as const,
].forEach((level) => {
const originalMethod = window.console[level];
if (!originalMethod) return;
const prefix = `${level.toUpperCase()} matrix_sdk`;
window.console[level] = (...args): void => {
originalMethod(...args);
// args for calls from the matrix-sdk-crypto-wasm look like:
// ["DEBUG matrix_sdk_indexeddb::crypto_store: IndexedDbCryptoStore: opening main store matrix-js-sdk::matrix-sdk-crypto\n at /home/runner/.cargo/git/checkouts/matrix-rust-sdk-1f4927f82a3d27bb/07aa6d7/crates/matrix-sdk-indexeddb/src/crypto_store/mod.rs:267"]
if (typeof args[0] === "string" && args[0].startsWith(prefix)) {
// we pass all the args on to the logger in case there are more sent in future
global.mx_rage_logger.log(LogLevel[level], "matrix_sdk", ...args);
}
};
});
return tryInitStorage();
}