|
@@ -6,8 +6,12 @@ import { APP_WILL_MOUNT } from '../../app';
|
6
|
6
|
import JitsiMeetJS, { LIB_WILL_INIT } from '../lib-jitsi-meet';
|
7
|
7
|
import { MiddlewareRegistry } from '../redux';
|
8
|
8
|
|
|
9
|
+import JitsiMeetInMemoryLogStorage
|
|
10
|
+ from '../../../../modules/util/JitsiMeetInMemoryLogStorage';
|
9
|
11
|
import JitsiMeetLogStorage from '../../../../modules/util/JitsiMeetLogStorage';
|
10
|
12
|
|
|
13
|
+import { isTestModeEnabled } from '../testing';
|
|
14
|
+
|
11
|
15
|
import { SET_LOGGING_CONFIG } from './actionTypes';
|
12
|
16
|
|
13
|
17
|
declare var APP: Object;
|
|
@@ -67,10 +71,11 @@ function _appWillMount({ getState }, next, action) {
|
67
|
71
|
*
|
68
|
72
|
* @param {Object} loggingConfig - The configuration with which logging is to be
|
69
|
73
|
* initialized.
|
|
74
|
+ * @param {boolean} isTestingEnabled - Is debug logging enabled.
|
70
|
75
|
* @private
|
71
|
76
|
* @returns {void}
|
72
|
77
|
*/
|
73
|
|
-function _initLogging(loggingConfig) {
|
|
78
|
+function _initLogging(loggingConfig, isTestingEnabled) {
|
74
|
79
|
// Create the LogCollector and register it as the global log transport. It
|
75
|
80
|
// is done early to capture as much logs as possible. Captured logs will be
|
76
|
81
|
// cached, before the JitsiMeetLogStorage gets ready (statistics module is
|
|
@@ -81,6 +86,16 @@ function _initLogging(loggingConfig) {
|
81
|
86
|
APP.logCollector = new Logger.LogCollector(new JitsiMeetLogStorage());
|
82
|
87
|
Logger.addGlobalTransport(APP.logCollector);
|
83
|
88
|
JitsiMeetJS.addGlobalLogTransport(APP.logCollector);
|
|
89
|
+
|
|
90
|
+ if (isTestingEnabled) {
|
|
91
|
+ APP.debugLogs = new JitsiMeetInMemoryLogStorage();
|
|
92
|
+ const debugLogCollector = new Logger.LogCollector(
|
|
93
|
+ APP.debugLogs, { storeInterval: 1000 });
|
|
94
|
+
|
|
95
|
+ Logger.addGlobalTransport(debugLogCollector);
|
|
96
|
+ JitsiMeetJS.addGlobalLogTransport(debugLogCollector);
|
|
97
|
+ debugLogCollector.start();
|
|
98
|
+ }
|
84
|
99
|
}
|
85
|
100
|
}
|
86
|
101
|
|
|
@@ -121,6 +136,7 @@ function _libWillInit({ getState }, next, action) {
|
121
|
136
|
function _setLoggingConfig({ getState }, next, action) {
|
122
|
137
|
const result = next(action);
|
123
|
138
|
const newValue = getState()['features/base/logging'].config;
|
|
139
|
+ const isTestingEnabled = isTestModeEnabled(getState());
|
124
|
140
|
|
125
|
141
|
// TODO Generally, we'll want to _setLogLevels and _initLogging only if the
|
126
|
142
|
// logging config values actually change.
|
|
@@ -131,7 +147,7 @@ function _setLoggingConfig({ getState }, next, action) {
|
131
|
147
|
_setLogLevels(Logger, newValue);
|
132
|
148
|
_setLogLevels(JitsiMeetJS, newValue);
|
133
|
149
|
|
134
|
|
- _initLogging(newValue);
|
|
150
|
+ _initLogging(newValue, isTestingEnabled);
|
135
|
151
|
|
136
|
152
|
return result;
|
137
|
153
|
}
|