fix(logging-config): Improve types

This commit is contained in:
Hristo Terezov
2025-01-15 12:21:58 -06:00
parent 8fc295b385
commit fb397db69f
4 changed files with 26 additions and 21 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -0,0 +1,9 @@
export type LogLevel = 'trace' | 'log' | 'info' | 'warn' | 'error';
export interface ILoggingConfig {
defaultLogLevel?: LogLevel;
disableLogCollector?: boolean;
loggers?: {
[key: string]: LogLevel;
};
}