review: Use Initializer instead of creating a component

This commit is contained in:
Valere
2026-05-11 17:43:34 +02:00
parent 25ac565f8b
commit 2ac221661b
4 changed files with 17 additions and 35 deletions

View File

@@ -23,12 +23,17 @@ import {
createRoutesFromChildren,
matchRoutes,
} from "react-router-dom";
import {
setLogExtension as setLKLogExtension,
setLogLevel as setLKLogLevel,
} from "livekit-client";
import { getUrlParams } from "./UrlParams";
import { Config } from "./config/Config";
import { platform } from "./Platform";
import { isFailure } from "./utils/fetch";
import { initializeWidget } from "./widget";
import { enableExtendedLivekitLogs } from "./settings/settings.ts";
// This generates a map of locale names to their URL (based on import.meta.url), which looks like this:
// {
@@ -189,6 +194,18 @@ export class Initializer {
// Add the platform to the DOM, so CSS can query it
document.body.setAttribute("data-platform", platform);
// livekit logging configuration
setLKLogExtension((level, msg, context) => {
// we pass a synthetic logger name of "livekit" to the rageshake to make it easier to read
global.mx_rage_logger.log(level, "livekit", msg, context);
});
enableExtendedLivekitLogs.value$.subscribe((enabled) => {
setLKLogLevel(enabled ? "trace" : "info");
});
window.setLKLogLevel = setLKLogLevel;
}
public static init(): Promise<void> | null {