Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(logging-config): Improve types

Hristo Terezovfb397db69fe6
diff --git a/config.js b/config.js
index 9d770464a5..81b9eedb4e 100644
--- a/config.js
+++ b/config.js
@@ -1845,9 +1845,10 @@ var config = {
// //disableLogCollector: true,
// // Individual loggers are customizable.
// loggers: {
- // // The following are too verbose in their logging with the default level.
- // 'modules/RTC/TraceablePeerConnection.js': 'info',
- // 'modules/xmpp/strophe.util.js': 'log',
+ // // The following are too verbose in their logging with the default level.
+ // 'modules/RTC/TraceablePeerConnection.js': 'info',
+ // 'modules/xmpp/strophe.util.js': 'log',
+ // },
// },
// Application logo url
diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.ts
index 9b9fe02246..89c8d0b8d6 100644
--- a/react/features/base/config/configType.ts
+++ b/react/features/base/config/configType.ts
@@ -1,4 +1,5 @@
import { ToolbarButton } from '../../toolbox/types';
+import { ILoggingConfig } from '../logging/types';
type ButtonsWithNotifyClick = 'camera' |
'chat' |
@@ -468,6 +469,7 @@ export interface IConfig {
};
localSubject?: string;
locationURL?: URL;
+ logging?: ILoggingConfig;
mainToolbarButtons?: Array<Array<string>>;
maxFullResolutionParticipants?: number;
microsoftApiApplicationClientID?: string;
diff --git a/react/features/base/logging/reducer.ts b/react/features/base/logging/reducer.ts
index fe9e99659c..ea9fb3b02c 100644
--- a/react/features/base/logging/reducer.ts
+++ b/react/features/base/logging/reducer.ts
@@ -5,10 +5,11 @@ import ReducerRegistry from '../redux/ReducerRegistry';
import { equals, set } from '../redux/functions';
import { SET_LOGGING_CONFIG, SET_LOG_COLLECTOR } from './actionTypes';
+import { ILoggingConfig, LogLevel } from './types';
-const DEFAULT_LOGGING_CONFIG = {
+const DEFAULT_LOGGING_CONFIG: ILoggingConfig = {
// default log level for the app and lib-jitsi-meet
- defaultLogLevel: 'trace' as LogLevel,
+ defaultLogLevel: 'trace',
// Option to disable LogCollector (which stores the logs)
// disableLogCollector: true,
@@ -16,8 +17,8 @@ const DEFAULT_LOGGING_CONFIG = {
loggers: {
// The following are too verbose in their logging with the
// {@link #defaultLogLevel}:
- 'modules/RTC/TraceablePeerConnection.js': 'info' as LogLevel,
- 'modules/xmpp/strophe.util.js': 'log' as LogLevel
+ 'modules/RTC/TraceablePeerConnection.js': 'info',
+ 'modules/xmpp/strophe.util.js': 'log'
}
};
@@ -39,11 +40,11 @@ const DEFAULT_STATE = {
// Reduce default verbosity on mobile, it kills performance.
if (navigator.product === 'ReactNative') {
- const RN_LOGGERS = {
- 'modules/sdp/SDPUtil.js': 'info' as LogLevel,
- 'modules/xmpp/ChatRoom.js': 'warn' as LogLevel,
- 'modules/xmpp/JingleSessionPC.js': 'info' as LogLevel,
- 'modules/xmpp/strophe.jingle.js': 'info' as LogLevel
+ const RN_LOGGERS: { [key: string]: LogLevel; } = {
+ 'modules/sdp/SDPUtil.js': 'info',
+ 'modules/xmpp/ChatRoom.js': 'warn',
+ 'modules/xmpp/JingleSessionPC.js': 'info',
+ 'modules/xmpp/strophe.jingle.js': 'info'
};
DEFAULT_STATE.config.loggers = {
@@ -52,16 +53,8 @@ if (navigator.product === 'ReactNative') {
};
}
-type LogLevel = 'trace' | 'log' | 'info' | 'warn' | 'error';
-
export interface ILoggingState {
- config: {
- defaultLogLevel: LogLevel;
- disableLogCollector?: boolean;
- loggers: {
- [key: string]: LogLevel;
- };
- };
+ config: ILoggingConfig;
logCollector?: {
flush: () => void;
start: () => void;
diff --git a/react/features/base/logging/types.ts b/react/features/base/logging/types.ts
new file mode 100644
index 0000000000..5025adaf9a
--- /dev/null
+++ b/react/features/base/logging/types.ts
@@ -0,0 +1,9 @@
+export type LogLevel = 'trace' | 'log' | 'info' | 'warn' | 'error';
+
+export interface ILoggingConfig {
+ defaultLogLevel?: LogLevel;
+ disableLogCollector?: boolean;
+ loggers?: {
+ [key: string]: LogLevel;
+ };
+}