🔇(frontend) remove LiveKit logs in production

Enabling logs by default in clients during production feels insecure.
Therefore, I have silenced all LiveKit logs.

This might pose a challenge if we need to debug a user in the future,
but currently, we don’t require these logs.

Additionally, my utils file and function work as intended,
though there is room for improvement.
This commit is contained in:
lebaudantoine
2024-08-02 14:28:12 +02:00
committed by aleb_the_flash
parent fb0ee9e8f6
commit 1971f594cf
2 changed files with 11 additions and 0 deletions

View File

@@ -10,12 +10,17 @@ import { Layout } from './layout/Layout'
import { NotFoundScreen } from './components/NotFoundScreen'
import { routes } from './routes'
import './i18n/init'
import { silenceLiveKitLogs } from "@/utils/livekit.ts";
const queryClient = new QueryClient()
function App() {
const { i18n } = useTranslation()
useLang(i18n.language)
const isProduction = import.meta.env.PROD
silenceLiveKitLogs(isProduction)
return (
<QueryClientProvider client={queryClient}>
<Suspense fallback={null}>

View File

@@ -0,0 +1,6 @@
import { LogLevel, setLogLevel } from "livekit-client";
export const silenceLiveKitLogs = (shouldSilenceLogs: boolean) => {
setLogLevel(shouldSilenceLogs ? LogLevel.silent : LogLevel.debug);
}