@livekit/react-native 1.3.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/logger.ts ADDED
@@ -0,0 +1,23 @@
1
+ import { setLogLevel as setClientSdkLogLevel } from 'livekit-client';
2
+ import loglevel from 'loglevel';
3
+
4
+ export const log = loglevel.getLogger('lk-react-native');
5
+ log.setDefaultLevel('WARN');
6
+
7
+ export type LogLevel = Parameters<typeof setClientSdkLogLevel>[0];
8
+ export type SetLogLevelOptions = {
9
+ liveKitClientLogLevel?: LogLevel;
10
+ };
11
+
12
+ /**
13
+ * Set the log level for both the `@livekit/react-native` package and the `@livekit-client` package.
14
+ * To set the `@livekit-client` log independently, use the `liveKitClientLogLevel` prop on the `options` object.
15
+ * @public
16
+ */
17
+ export function setLogLevel(
18
+ level: LogLevel,
19
+ options: SetLogLevelOptions = {}
20
+ ): void {
21
+ log.setLevel(level);
22
+ setClientSdkLogLevel(options.liveKitClientLogLevel ?? level);
23
+ }