Przeglądaj źródła

fix(logging-config): Improve types

factor2
Hristo Terezov 5 miesięcy temu
rodzic
commit
fb397db69f

+ 4
- 3
config.js Wyświetl plik

@@ -1845,9 +1845,10 @@ var config = {
1845 1845
     //      //disableLogCollector: true,
1846 1846
     //      // Individual loggers are customizable.
1847 1847
     //      loggers: {
1848
-    //      // The following are too verbose in their logging with the default level.
1849
-    //      'modules/RTC/TraceablePeerConnection.js': 'info',
1850
-    //      'modules/xmpp/strophe.util.js': 'log',
1848
+    //          // The following are too verbose in their logging with the default level.
1849
+    //          'modules/RTC/TraceablePeerConnection.js': 'info',
1850
+    //          'modules/xmpp/strophe.util.js': 'log',
1851
+    //      },
1851 1852
     // },
1852 1853
 
1853 1854
     // Application logo url

+ 2
- 0
react/features/base/config/configType.ts Wyświetl plik

@@ -1,4 +1,5 @@
1 1
 import { ToolbarButton } from '../../toolbox/types';
2
+import { ILoggingConfig } from '../logging/types';
2 3
 
3 4
 type ButtonsWithNotifyClick = 'camera' |
4 5
     'chat' |
@@ -468,6 +469,7 @@ export interface IConfig {
468 469
     };
469 470
     localSubject?: string;
470 471
     locationURL?: URL;
472
+    logging?: ILoggingConfig;
471 473
     mainToolbarButtons?: Array<Array<string>>;
472 474
     maxFullResolutionParticipants?: number;
473 475
     microsoftApiApplicationClientID?: string;

+ 11
- 18
react/features/base/logging/reducer.ts Wyświetl plik

@@ -5,10 +5,11 @@ import ReducerRegistry from '../redux/ReducerRegistry';
5 5
 import { equals, set } from '../redux/functions';
6 6
 
7 7
 import { SET_LOGGING_CONFIG, SET_LOG_COLLECTOR } from './actionTypes';
8
+import { ILoggingConfig, LogLevel } from './types';
8 9
 
9
-const DEFAULT_LOGGING_CONFIG = {
10
+const DEFAULT_LOGGING_CONFIG: ILoggingConfig = {
10 11
     // default log level for the app and lib-jitsi-meet
11
-    defaultLogLevel: 'trace' as LogLevel,
12
+    defaultLogLevel: 'trace',
12 13
 
13 14
     // Option to disable LogCollector (which stores the logs)
14 15
     // disableLogCollector: true,
@@ -16,8 +17,8 @@ const DEFAULT_LOGGING_CONFIG = {
16 17
     loggers: {
17 18
         // The following are too verbose in their logging with the
18 19
         // {@link #defaultLogLevel}:
19
-        'modules/RTC/TraceablePeerConnection.js': 'info' as LogLevel,
20
-        'modules/xmpp/strophe.util.js': 'log' as LogLevel
20
+        'modules/RTC/TraceablePeerConnection.js': 'info',
21
+        'modules/xmpp/strophe.util.js': 'log'
21 22
     }
22 23
 };
23 24
 
@@ -39,11 +40,11 @@ const DEFAULT_STATE = {
39 40
 
40 41
 // Reduce default verbosity on mobile, it kills performance.
41 42
 if (navigator.product === 'ReactNative') {
42
-    const RN_LOGGERS = {
43
-        'modules/sdp/SDPUtil.js': 'info' as LogLevel,
44
-        'modules/xmpp/ChatRoom.js': 'warn' as LogLevel,
45
-        'modules/xmpp/JingleSessionPC.js': 'info' as LogLevel,
46
-        'modules/xmpp/strophe.jingle.js': 'info' as LogLevel
43
+    const RN_LOGGERS: { [key: string]: LogLevel; } = {
44
+        'modules/sdp/SDPUtil.js': 'info',
45
+        'modules/xmpp/ChatRoom.js': 'warn',
46
+        'modules/xmpp/JingleSessionPC.js': 'info',
47
+        'modules/xmpp/strophe.jingle.js': 'info'
47 48
     };
48 49
 
49 50
     DEFAULT_STATE.config.loggers = {
@@ -52,16 +53,8 @@ if (navigator.product === 'ReactNative') {
52 53
     };
53 54
 }
54 55
 
55
-type LogLevel = 'trace' | 'log' | 'info' | 'warn' | 'error';
56
-
57 56
 export interface ILoggingState {
58
-    config: {
59
-        defaultLogLevel: LogLevel;
60
-        disableLogCollector?: boolean;
61
-        loggers: {
62
-            [key: string]: LogLevel;
63
-        };
64
-    };
57
+    config: ILoggingConfig;
65 58
     logCollector?: {
66 59
         flush: () => void;
67 60
         start: () => void;

+ 9
- 0
react/features/base/logging/types.ts Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz