瀏覽代碼

Merge pull request #1158 from jitsi/log_collector

Log collector
j8
hristoterezov 8 年之前
父節點
當前提交
8745efb81f

+ 102
- 6
app.js 查看文件

1
-/* global $, config, getRoomName */
1
+/* global $, config, getRoomName, loggingConfig, JitsiMeetJS */
2
 /* application specific logic */
2
 /* application specific logic */
3
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
 
4
 
4
 import "babel-polyfill";
5
 import "babel-polyfill";
5
 import "jquery";
6
 import "jquery";
18
 
19
 
19
 window.toastr = require("toastr");
20
 window.toastr = require("toastr");
20
 
21
 
22
+const Logger = require("jitsi-meet-logger");
23
+const LogCollector = Logger.LogCollector;
24
+import JitsiMeetLogStorage from "./modules/util/JitsiMeetLogStorage";
25
+
21
 import URLProcessor from "./modules/config/URLProcessor";
26
 import URLProcessor from "./modules/config/URLProcessor";
22
 import RoomnameGenerator from './modules/util/RoomnameGenerator';
27
 import RoomnameGenerator from './modules/util/RoomnameGenerator';
23
 
28
 
31
 import getTokenData from "./modules/tokendata/TokenData";
36
 import getTokenData from "./modules/tokendata/TokenData";
32
 import translation from "./modules/translation/translation";
37
 import translation from "./modules/translation/translation";
33
 
38
 
39
+const ConferenceEvents = JitsiMeetJS.events.conference;
40
+
34
 /**
41
 /**
35
  * Tries to push history state with the following parameters:
42
  * Tries to push history state with the following parameters:
36
  * 'VideoChat', `Room: ${roomName}`, URL. If fail, prints the error and returns
43
  * 'VideoChat', `Room: ${roomName}`, URL. If fail, prints the error and returns
42
             'VideoChat', `Room: ${roomName}`, URL
49
             'VideoChat', `Room: ${roomName}`, URL
43
         );
50
         );
44
     } catch (e) {
51
     } catch (e) {
45
-        console.warn("Push history state failed with parameters:",
52
+        logger.warn("Push history state failed with parameters:",
46
             'VideoChat', `Room: ${roomName}`, URL, e);
53
             'VideoChat', `Room: ${roomName}`, URL, e);
47
         return e;
54
         return e;
48
     }
55
     }
78
     return roomName;
85
     return roomName;
79
 }
86
 }
80
 
87
 
88
+/**
89
+ * Adjusts the logging levels.
90
+ * @private
91
+ */
92
+function configureLoggingLevels () {
93
+    // NOTE The library Logger is separated from the app loggers, so the levels
94
+    // have to be set in two places
95
+
96
+    // Set default logging level
97
+    const defaultLogLevel
98
+        = loggingConfig.defaultLogLevel || JitsiMeetJS.logLevels.TRACE;
99
+    Logger.setLogLevel(defaultLogLevel);
100
+    JitsiMeetJS.setLogLevel(defaultLogLevel);
101
+
102
+    // NOTE console was used on purpose here to go around the logging
103
+    // and always print the default logging level to the console
104
+    console.info("Default logging level set to: " + defaultLogLevel);
105
+
106
+    // Set log level for each logger
107
+    if (loggingConfig) {
108
+        Object.keys(loggingConfig).forEach(function(loggerName) {
109
+            if ('defaultLogLevel' !== loggerName) {
110
+                const level = loggingConfig[loggerName];
111
+                Logger.setLogLevelById(level, loggerName);
112
+                JitsiMeetJS.setLogLevelById(level, loggerName);
113
+            }
114
+        });
115
+    }
116
+}
117
+
81
 const APP = {
118
 const APP = {
82
     // Used by do_external_connect.js if we receive the attach data after
119
     // Used by do_external_connect.js if we receive the attach data after
83
     // connect was already executed. status property can be "initialized",
120
     // connect was already executed. status property can be "initialized",
97
     settings,
134
     settings,
98
     conference,
135
     conference,
99
     translation,
136
     translation,
137
+    /**
138
+     * The log collector which captures JS console logs for this app.
139
+     * @type {LogCollector}
140
+     */
141
+    logCollector: null,
142
+    /**
143
+     * Indicates if the log collector has been started (it will not be started
144
+     * if the welcome page is displayed).
145
+     */
146
+    logCollectorStarted : false,
100
     /**
147
     /**
101
      * After the APP has been initialized provides utility methods for dealing
148
      * After the APP has been initialized provides utility methods for dealing
102
      * with the conference room URL(address).
149
      * with the conference room URL(address).
106
     connection: null,
153
     connection: null,
107
     API,
154
     API,
108
     init () {
155
     init () {
156
+        this.initLogging();
109
         this.keyboardshortcut =
157
         this.keyboardshortcut =
110
             require("./modules/keyboardshortcut/keyboardshortcut");
158
             require("./modules/keyboardshortcut/keyboardshortcut");
111
         this.configFetch = require("./modules/config/HttpConfigFetch");
159
         this.configFetch = require("./modules/config/HttpConfigFetch");
112
         this.tokenData = getTokenData();
160
         this.tokenData = getTokenData();
161
+    },
162
+    initLogging () {
163
+        // Adjust logging level
164
+        configureLoggingLevels();
165
+        // Create the LogCollector and register it as the global log transport.
166
+        // It is done early to capture as much logs as possible. Captured logs
167
+        // will be cached, before the JitsiMeetLogStorage gets ready (statistics
168
+        // module is initialized).
169
+        if (!this.logCollector && !loggingConfig.disableLogCollector) {
170
+            this.logCollector = new LogCollector(new JitsiMeetLogStorage());
171
+            Logger.addGlobalTransport(this.logCollector);
172
+            JitsiMeetJS.addGlobalLogTransport(this.logCollector);
173
+        }
113
     }
174
     }
114
 };
175
 };
115
 
176
 
131
     APP.ConferenceUrl = new ConferenceUrl(window.location);
192
     APP.ConferenceUrl = new ConferenceUrl(window.location);
132
     // Clean up the URL displayed by the browser
193
     // Clean up the URL displayed by the browser
133
     replaceHistoryState(APP.ConferenceUrl.getInviteUrl());
194
     replaceHistoryState(APP.ConferenceUrl.getInviteUrl());
134
-    var isUIReady = APP.UI.start();
195
+    const isUIReady = APP.UI.start();
135
     if (isUIReady) {
196
     if (isUIReady) {
136
         APP.conference.init({roomName: buildRoomName()}).then(function () {
197
         APP.conference.init({roomName: buildRoomName()}).then(function () {
198
+
199
+            if (APP.logCollector) {
200
+                // Start the LogCollector's periodic "store logs" task only if
201
+                // we're in the conference and not on the welcome page. This is
202
+                // determined by the value of "isUIReady" const above.
203
+                APP.logCollector.start();
204
+                APP.logCollectorStarted = true;
205
+                // Make an attempt to flush in case a lot of logs have been
206
+                // cached, before the collector was started.
207
+                APP.logCollector.flush();
208
+
209
+                // This event listener will flush the logs, before
210
+                // the statistics module (CallStats) is stopped.
211
+                //
212
+                // NOTE The LogCollector is not stopped, because this event can
213
+                // be triggered multiple times during single conference
214
+                // (whenever statistics module is stopped). That includes
215
+                // the case when Jicofo terminates the single person left in the
216
+                // room. It will then restart the media session when someone
217
+                // eventually join the room which will start the stats again.
218
+                APP.conference.addConferenceListener(
219
+                    ConferenceEvents.BEFORE_STATISTICS_DISPOSED,
220
+                    () => {
221
+                        if (APP.logCollector) {
222
+                            APP.logCollector.flush();
223
+                        }
224
+                    }
225
+                );
226
+            }
227
+
137
             APP.UI.initConference();
228
             APP.UI.initConference();
138
 
229
 
139
             APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) {
230
             APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) {
145
         }).catch(function (err) {
236
         }).catch(function (err) {
146
             APP.UI.hideRingOverLay();
237
             APP.UI.hideRingOverLay();
147
             APP.API.notifyConferenceLeft(APP.conference.roomName);
238
             APP.API.notifyConferenceLeft(APP.conference.roomName);
148
-            console.error(err);
239
+            logger.error(err);
149
         });
240
         });
150
     }
241
     }
151
 }
242
 }
169
                 if (success) {
260
                 if (success) {
170
                     var now = APP.connectionTimes["configuration.fetched"] =
261
                     var now = APP.connectionTimes["configuration.fetched"] =
171
                         window.performance.now();
262
                         window.performance.now();
172
-                    console.log("(TIME) configuration fetched:\t", now);
263
+                    logger.log("(TIME) configuration fetched:\t", now);
173
                     init();
264
                     init();
174
                 } else {
265
                 } else {
175
                     // Show obtain config error,
266
                     // Show obtain config error,
189
 
280
 
190
 $(document).ready(function () {
281
 $(document).ready(function () {
191
     var now = APP.connectionTimes["document.ready"] = window.performance.now();
282
     var now = APP.connectionTimes["document.ready"] = window.performance.now();
192
-    console.log("(TIME) document ready:\t", now);
283
+    logger.log("(TIME) document ready:\t", now);
193
 
284
 
194
     URLProcessor.setConfigParametersFromUrl();
285
     URLProcessor.setConfigParametersFromUrl();
195
 
286
 
211
 });
302
 });
212
 
303
 
213
 $(window).bind('beforeunload', function () {
304
 $(window).bind('beforeunload', function () {
305
+    // Stop the LogCollector
306
+    if (APP.logCollectorStarted) {
307
+        APP.logCollector.stop();
308
+        APP.logCollectorStarted = false;
309
+    }
214
     APP.API.dispose();
310
     APP.API.dispose();
215
 });
311
 });
216
 
312
 

+ 34
- 25
conference.js 查看文件

1
 /* global $, APP, JitsiMeetJS, config, interfaceConfig */
1
 /* global $, APP, JitsiMeetJS, config, interfaceConfig */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2
 import {openConnection} from './connection';
4
 import {openConnection} from './connection';
3
 import Invite from './modules/UI/invite/Invite';
5
 import Invite from './modules/UI/invite/Invite';
4
 import ContactList from './modules/UI/side_pannels/contactlist/ContactList';
6
 import ContactList from './modules/UI/side_pannels/contactlist/ContactList';
166
     const method = muted ? 'mute' : 'unmute';
168
     const method = muted ? 'mute' : 'unmute';
167
 
169
 
168
     localMedia[method]().catch(reason => {
170
     localMedia[method]().catch(reason => {
169
-        console.warn(`${localMediaTypeString} ${method} was rejected:`, reason);
171
+        logger.warn(`${localMediaTypeString} ${method} was rejected:`, reason);
170
     });
172
     });
171
 }
173
 }
172
 
174
 
254
             });
256
             });
255
             return tracks;
257
             return tracks;
256
         }).catch(function (err) {
258
         }).catch(function (err) {
257
-            console.error(
259
+            logger.error(
258
                 'failed to create local tracks', options.devices, err);
260
                 'failed to create local tracks', options.devices, err);
259
             return Promise.reject(err);
261
             return Promise.reject(err);
260
         });
262
         });
311
         this._reject(err);
313
         this._reject(err);
312
     }
314
     }
313
     _onConferenceFailed(err, ...params) {
315
     _onConferenceFailed(err, ...params) {
314
-        console.error('CONFERENCE FAILED:', err, ...params);
316
+        logger.error('CONFERENCE FAILED:', err, ...params);
315
         APP.UI.hideRingOverLay();
317
         APP.UI.hideRingOverLay();
316
         switch (err) {
318
         switch (err) {
317
             // room is locked by the password
319
             // room is locked by the password
400
         }
402
         }
401
     }
403
     }
402
     _onConferenceError(err, ...params) {
404
     _onConferenceError(err, ...params) {
403
-        console.error('CONFERENCE Error:', err, params);
405
+        logger.error('CONFERENCE Error:', err, params);
404
         switch (err) {
406
         switch (err) {
405
         case ConferenceErrors.CHAT_ERROR:
407
         case ConferenceErrors.CHAT_ERROR:
406
             {
408
             {
409
             }
411
             }
410
             break;
412
             break;
411
         default:
413
         default:
412
-            console.error("Unknown error.");
414
+            logger.error("Unknown error.", err);
413
         }
415
         }
414
     }
416
     }
415
     _unsubscribe() {
417
     _unsubscribe() {
464
      */
466
      */
465
     init(options) {
467
     init(options) {
466
         this.roomName = options.roomName;
468
         this.roomName = options.roomName;
467
-        JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.TRACE);
468
-
469
         // attaches global error handler, if there is already one, respect it
469
         // attaches global error handler, if there is already one, respect it
470
         if(JitsiMeetJS.getGlobalOnErrorHandler){
470
         if(JitsiMeetJS.getGlobalOnErrorHandler){
471
             var oldOnErrorHandler = window.onerror;
471
             var oldOnErrorHandler = window.onerror;
495
                 analytics.init();
495
                 analytics.init();
496
                 return createInitialLocalTracksAndConnect(options.roomName);
496
                 return createInitialLocalTracksAndConnect(options.roomName);
497
             }).then(([tracks, con]) => {
497
             }).then(([tracks, con]) => {
498
-                console.log('initialized with %s local tracks', tracks.length);
498
+                logger.log('initialized with %s local tracks', tracks.length);
499
                 APP.connection = connection = con;
499
                 APP.connection = connection = con;
500
                 this._bindConnectionFailedHandler(con);
500
                 this._bindConnectionFailedHandler(con);
501
                 this._createRoom(tracks);
501
                 this._createRoom(tracks);
549
                 // - item-not-found
549
                 // - item-not-found
550
                 // - connection dropped(closed by Strophe unexpectedly
550
                 // - connection dropped(closed by Strophe unexpectedly
551
                 //   possible due too many transport errors)
551
                 //   possible due too many transport errors)
552
-                console.error("XMPP connection error: " + errMsg);
552
+                logger.error("XMPP connection error: " + errMsg);
553
                 APP.UI.showPageReloadOverlay();
553
                 APP.UI.showPageReloadOverlay();
554
                 connection.removeEventListener(
554
                 connection.removeEventListener(
555
                     ConnectionEvents.CONNECTION_FAILED, handler);
555
                     ConnectionEvents.CONNECTION_FAILED, handler);
879
             } else if (track.isVideoTrack()) {
879
             } else if (track.isVideoTrack()) {
880
                 return this.useVideoStream(track);
880
                 return this.useVideoStream(track);
881
             } else {
881
             } else {
882
-                console.error(
882
+                logger.error(
883
                     "Ignored not an audio nor a video track: ", track);
883
                     "Ignored not an audio nor a video track: ", track);
884
                 return Promise.resolve();
884
                 return Promise.resolve();
885
             }
885
             }
971
     videoSwitchInProgress: false,
971
     videoSwitchInProgress: false,
972
     toggleScreenSharing (shareScreen = !this.isSharingScreen) {
972
     toggleScreenSharing (shareScreen = !this.isSharingScreen) {
973
         if (this.videoSwitchInProgress) {
973
         if (this.videoSwitchInProgress) {
974
-            console.warn("Switch in progress.");
974
+            logger.warn("Switch in progress.");
975
             return;
975
             return;
976
         }
976
         }
977
         if (!this.isDesktopSharingEnabled) {
977
         if (!this.isDesktopSharingEnabled) {
978
-            console.warn("Cannot toggle screen sharing: not supported.");
978
+            logger.warn("Cannot toggle screen sharing: not supported.");
979
             return;
979
             return;
980
         }
980
         }
981
 
981
 
1029
                 this.videoSwitchInProgress = false;
1029
                 this.videoSwitchInProgress = false;
1030
                 JitsiMeetJS.analytics.sendEvent(
1030
                 JitsiMeetJS.analytics.sendEvent(
1031
                     'conference.sharingDesktop.start');
1031
                     'conference.sharingDesktop.start');
1032
-                console.log('sharing local desktop');
1032
+                logger.log('sharing local desktop');
1033
             }).catch((err) => {
1033
             }).catch((err) => {
1034
                 // close external installation dialog to show the error.
1034
                 // close external installation dialog to show the error.
1035
                 if(externalInstallation)
1035
                 if(externalInstallation)
1041
                     return;
1041
                     return;
1042
                 }
1042
                 }
1043
 
1043
 
1044
-                console.error('failed to share local desktop', err);
1044
+                logger.error('failed to share local desktop', err);
1045
 
1045
 
1046
                 if (err.name === TrackErrors.FIREFOX_EXTENSION_NEEDED) {
1046
                 if (err.name === TrackErrors.FIREFOX_EXTENSION_NEEDED) {
1047
                     APP.UI.showExtensionRequiredDialog(
1047
                     APP.UI.showExtensionRequiredDialog(
1078
                 this.videoSwitchInProgress = false;
1078
                 this.videoSwitchInProgress = false;
1079
                 JitsiMeetJS.analytics.sendEvent(
1079
                 JitsiMeetJS.analytics.sendEvent(
1080
                     'conference.sharingDesktop.stop');
1080
                     'conference.sharingDesktop.stop');
1081
-                console.log('sharing local video');
1081
+                logger.log('sharing local video');
1082
             }).catch((err) => {
1082
             }).catch((err) => {
1083
                 this.useVideoStream(null);
1083
                 this.useVideoStream(null);
1084
                 this.videoSwitchInProgress = false;
1084
                 this.videoSwitchInProgress = false;
1085
-                console.error('failed to share local video', err);
1085
+                logger.error('failed to share local video', err);
1086
             });
1086
             });
1087
         }
1087
         }
1088
     },
1088
     },
1108
             if (user.isHidden())
1108
             if (user.isHidden())
1109
                 return;
1109
                 return;
1110
 
1110
 
1111
-            console.log('USER %s connnected', id, user);
1111
+            logger.log('USER %s connnected', id, user);
1112
             APP.API.notifyUserJoined(id);
1112
             APP.API.notifyUserJoined(id);
1113
             APP.UI.addUser(user);
1113
             APP.UI.addUser(user);
1114
 
1114
 
1116
             APP.UI.updateUserRole(user);
1116
             APP.UI.updateUserRole(user);
1117
         });
1117
         });
1118
         room.on(ConferenceEvents.USER_LEFT, (id, user) => {
1118
         room.on(ConferenceEvents.USER_LEFT, (id, user) => {
1119
-            console.log('USER %s LEFT', id, user);
1119
+            logger.log('USER %s LEFT', id, user);
1120
             APP.API.notifyUserLeft(id);
1120
             APP.API.notifyUserLeft(id);
1121
             APP.UI.removeUser(id, user.getDisplayName());
1121
             APP.UI.removeUser(id, user.getDisplayName());
1122
             APP.UI.onSharedVideoStop(id);
1122
             APP.UI.onSharedVideoStop(id);
1125
 
1125
 
1126
         room.on(ConferenceEvents.USER_ROLE_CHANGED, (id, role) => {
1126
         room.on(ConferenceEvents.USER_ROLE_CHANGED, (id, role) => {
1127
             if (this.isLocalId(id)) {
1127
             if (this.isLocalId(id)) {
1128
-                console.info(`My role changed, new role: ${role}`);
1128
+                logger.info(`My role changed, new role: ${role}`);
1129
                 if (this.isModerator !== room.isModerator()) {
1129
                 if (this.isModerator !== room.isModerator()) {
1130
                     this.isModerator = room.isModerator();
1130
                     this.isModerator = room.isModerator();
1131
                     APP.UI.updateLocalRole(room.isModerator());
1131
                     APP.UI.updateLocalRole(room.isModerator());
1183
             {
1183
             {
1184
                 this.audioLevelsMap[id] = lvl;
1184
                 this.audioLevelsMap[id] = lvl;
1185
                 if(config.debugAudioLevels)
1185
                 if(config.debugAudioLevels)
1186
-                    console.log("AudioLevel:" + id + "/" + lvl);
1186
+                    logger.log("AudioLevel:" + id + "/" + lvl);
1187
             }
1187
             }
1188
 
1188
 
1189
             APP.UI.setAudioLevel(id, lvl);
1189
             APP.UI.setAudioLevel(id, lvl);
1264
         });
1264
         });
1265
 
1265
 
1266
         room.on(ConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => {
1266
         room.on(ConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => {
1267
-            console.log("Received recorder status change: ", status, error);
1267
+            logger.log("Received recorder status change: ", status, error);
1268
             APP.UI.updateRecordingState(status);
1268
             APP.UI.updateRecordingState(status);
1269
         });
1269
         });
1270
 
1270
 
1500
                 })
1500
                 })
1501
                 .then(([stream]) => {
1501
                 .then(([stream]) => {
1502
                     this.useVideoStream(stream);
1502
                     this.useVideoStream(stream);
1503
-                    console.log('switched local video device');
1503
+                    logger.log('switched local video device');
1504
                     APP.settings.setCameraDeviceId(cameraDeviceId, true);
1504
                     APP.settings.setCameraDeviceId(cameraDeviceId, true);
1505
                 })
1505
                 })
1506
                 .catch((err) => {
1506
                 .catch((err) => {
1522
                 })
1522
                 })
1523
                 .then(([stream]) => {
1523
                 .then(([stream]) => {
1524
                     this.useAudioStream(stream);
1524
                     this.useAudioStream(stream);
1525
-                    console.log('switched local audio device');
1525
+                    logger.log('switched local audio device');
1526
                     APP.settings.setMicDeviceId(micDeviceId, true);
1526
                     APP.settings.setMicDeviceId(micDeviceId, true);
1527
                 })
1527
                 })
1528
                 .catch((err) => {
1528
                 .catch((err) => {
1538
                 JitsiMeetJS.analytics.sendEvent(
1538
                 JitsiMeetJS.analytics.sendEvent(
1539
                     'settings.changeDevice.audioOut');
1539
                     'settings.changeDevice.audioOut');
1540
                 APP.settings.setAudioOutputDeviceId(audioOutputDeviceId)
1540
                 APP.settings.setAudioOutputDeviceId(audioOutputDeviceId)
1541
-                    .then(() => console.log('changed audio output device'))
1541
+                    .then(() => logger.log('changed audio output device'))
1542
                     .catch((err) => {
1542
                     .catch((err) => {
1543
-                        console.warn('Failed to change audio output device. ' +
1543
+                        logger.warn('Failed to change audio output device. ' +
1544
                             'Default or previously set audio output device ' +
1544
                             'Default or previously set audio output device ' +
1545
                             'will be used instead.', err);
1545
                             'will be used instead.', err);
1546
                         APP.UI.setSelectedAudioOutputFromSettings();
1546
                         APP.UI.setSelectedAudioOutputFromSettings();
1746
             room.sendApplicationLog(JSON.stringify({name, value}));
1746
             room.sendApplicationLog(JSON.stringify({name, value}));
1747
         }
1747
         }
1748
     },
1748
     },
1749
+    /**
1750
+     * Methods logs an application event given in the JSON format.
1751
+     * @param {string} logJSON an event to be logged in JSON format
1752
+     */
1753
+    logJSON(logJSON) {
1754
+        if (room) {
1755
+            room.sendApplicationLog(logJSON);
1756
+        }
1757
+    },
1749
     /**
1758
     /**
1750
      * Disconnect from the conference and optionally request user feedback.
1759
      * Disconnect from the conference and optionally request user feedback.
1751
      * @param {boolean} [requestFeedback=false] if user feedback should be
1760
      * @param {boolean} [requestFeedback=false] if user feedback should be

+ 3
- 1
connection.js 查看文件

1
 /* global APP, JitsiMeetJS, config */
1
 /* global APP, JitsiMeetJS, config */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2
 import AuthHandler from './modules/UI/authentication/AuthHandler';
4
 import AuthHandler from './modules/UI/authentication/AuthHandler';
3
 import jitsiLocalStorage from './modules/util/JitsiLocalStorage';
5
 import jitsiLocalStorage from './modules/util/JitsiLocalStorage';
4
 
6
 
84
 
86
 
85
         function handleConnectionFailed(err) {
87
         function handleConnectionFailed(err) {
86
             unsubscribe();
88
             unsubscribe();
87
-            console.error("CONNECTION FAILED:", err);
89
+            logger.error("CONNECTION FAILED:", err);
88
             reject(err);
90
             reject(err);
89
         }
91
         }
90
 
92
 

+ 2
- 0
index.html 查看文件

14
             "utils.js",
14
             "utils.js",
15
             "do_external_connect.js",
15
             "do_external_connect.js",
16
             "interface_config.js",
16
             "interface_config.js",
17
+            "logging_config.js",
17
             "lib-jitsi-meet.min.js",
18
             "lib-jitsi-meet.min.js",
18
             "app.bundle.min.js",
19
             "app.bundle.min.js",
19
             "all.css"
20
             "all.css"
43
     <!--#include virtual="connection_optimization/connection_optimization.html" -->
44
     <!--#include virtual="connection_optimization/connection_optimization.html" -->
44
     <script src="connection_optimization/do_external_connect.js?v=1"></script>
45
     <script src="connection_optimization/do_external_connect.js?v=1"></script>
45
     <script><!--#include virtual="/interface_config.js" --></script>
46
     <script><!--#include virtual="/interface_config.js" --></script>
47
+    <script><!--#include virtual="/logging_config.js" --></script>
46
     <script src="libs/lib-jitsi-meet.min.js?v=139"></script>
48
     <script src="libs/lib-jitsi-meet.min.js?v=139"></script>
47
     <script src="libs/app.bundle.min.js?v=139"></script>
49
     <script src="libs/app.bundle.min.js?v=139"></script>
48
     <!--#include virtual="title.html" -->
50
     <!--#include virtual="title.html" -->

+ 10
- 0
logging_config.js 查看文件

1
+// Logging configuration
2
+var loggingConfig = { // eslint-disable-line no-unused-vars
3
+    //default log level for the app and lib-jitsi-meet
4
+    //defaultLogLevel: 'trace',
5
+    // Option to disable LogCollector (which stores the logs on CallStats)
6
+    //disableLogCollector: true,
7
+    // Examples:
8
+    //'modules/version/ComponentsVersions.js': 'info',
9
+    //'modules/xmpp/ChatRoom.js': 'log'
10
+};

+ 4
- 2
modules/API/API.js 查看文件

1
 /* global APP, getConfigParamsFromUrl */
1
 /* global APP, getConfigParamsFromUrl */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2
 /**
4
 /**
3
  * Implements API class that communicates with external api class
5
  * Implements API class that communicates with external api class
4
  * and provides interface to access Jitsi Meet features by external
6
  * and provides interface to access Jitsi Meet features by external
131
     switch (message.type) {
133
     switch (message.type) {
132
         case "eventStatus":
134
         case "eventStatus":
133
             if(!message.name || !message.value) {
135
             if(!message.name || !message.value) {
134
-                console.warn("Unknown system message format", message);
136
+                logger.warn("Unknown system message format", message);
135
                 break;
137
                 break;
136
             }
138
             }
137
             events[message.name] = message.value;
139
             events[message.name] = message.value;
138
             break;
140
             break;
139
         default:
141
         default:
140
-            console.warn("Unknown system message type", message);
142
+            logger.warn("Unknown system message type", message);
141
     }
143
     }
142
 }
144
 }
143
 
145
 

+ 6
- 4
modules/API/external/external_api.js 查看文件

1
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
+
1
 /**
3
 /**
2
  * Implements API class that embeds Jitsi Meet in external applications.
4
  * Implements API class that embeds Jitsi Meet in external applications.
3
  */
5
  */
72
  */
74
  */
73
 function changeEventStatus(postis, event, status) {
75
 function changeEventStatus(postis, event, status) {
74
     if(!(event in events)) {
76
     if(!(event in events)) {
75
-        console.error("Not supported event name.");
77
+        logger.error("Not supported event name.");
76
         return;
78
         return;
77
     }
79
     }
78
     sendMessage(postis, {
80
     sendMessage(postis, {
174
  */
176
  */
175
 JitsiMeetExternalAPI.prototype.executeCommand = function(name, argumentsList) {
177
 JitsiMeetExternalAPI.prototype.executeCommand = function(name, argumentsList) {
176
     if(!(name in commands)) {
178
     if(!(name in commands)) {
177
-        console.error("Not supported command name.");
179
+        logger.error("Not supported command name.");
178
         return;
180
         return;
179
     }
181
     }
180
     var argumentsArray = argumentsList;
182
     var argumentsArray = argumentsList;
306
  */
308
  */
307
 JitsiMeetExternalAPI.prototype.addEventListener = function(event, listener) {
309
 JitsiMeetExternalAPI.prototype.addEventListener = function(event, listener) {
308
     if(!(event in events)) {
310
     if(!(event in events)) {
309
-        console.error("Not supported event name.");
311
+        logger.error("Not supported event name.");
310
         return;
312
         return;
311
     }
313
     }
312
     // We cannot remove listeners from postis that's why we are handling the
314
     // We cannot remove listeners from postis that's why we are handling the
328
 JitsiMeetExternalAPI.prototype.removeEventListener = function(event) {
330
 JitsiMeetExternalAPI.prototype.removeEventListener = function(event) {
329
     if(!(event in this.eventHandlers))
331
     if(!(event in this.eventHandlers))
330
     {
332
     {
331
-        console.error("The event " + event + " is not registered.");
333
+        logger.error("The event " + event + " is not registered.");
332
         return;
334
         return;
333
     }
335
     }
334
     delete this.eventHandlers[event];
336
     delete this.eventHandlers[event];

+ 2
- 1
modules/FollowMe.js 查看文件

13
  * See the License for the specific language governing permissions and
13
  * See the License for the specific language governing permissions and
14
  * limitations under the License.
14
  * limitations under the License.
15
  */
15
  */
16
+const logger = require("jitsi-meet-logger").getLogger(__filename);
16
 
17
 
17
 import UIEvents from '../service/UI/UIEvents';
18
 import UIEvents from '../service/UI/UIEvents';
18
 import VideoLayout from './UI/videolayout/VideoLayout';
19
 import VideoLayout from './UI/videolayout/VideoLayout';
308
 
309
 
309
         if (!this._conference.isParticipantModerator(id))
310
         if (!this._conference.isParticipantModerator(id))
310
         {
311
         {
311
-            console.warn('Received follow-me command ' +
312
+            logger.warn('Received follow-me command ' +
312
                 'not from moderator');
313
                 'not from moderator');
313
             return;
314
             return;
314
         }
315
         }

+ 5
- 3
modules/UI/UI.js 查看文件

1
 /* global APP, JitsiMeetJS, $, config, interfaceConfig, toastr */
1
 /* global APP, JitsiMeetJS, $, config, interfaceConfig, toastr */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2
 var UI = {};
4
 var UI = {};
3
 
5
 
4
 import Chat from "./side_pannels/chat/Chat";
6
 import Chat from "./side_pannels/chat/Chat";
503
         VideoLayout.changeLocalVideo(track);
505
         VideoLayout.changeLocalVideo(track);
504
         break;
506
         break;
505
     default:
507
     default:
506
-        console.error("Unknown stream type: " + track.getType());
508
+        logger.error("Unknown stream type: " + track.getType());
507
         break;
509
         break;
508
     }
510
     }
509
 };
511
 };
541
     if (etherpadManager || !config.etherpad_base || !name) {
543
     if (etherpadManager || !config.etherpad_base || !name) {
542
         return;
544
         return;
543
     }
545
     }
544
-    console.log('Etherpad is enabled');
546
+    logger.log('Etherpad is enabled');
545
     etherpadManager
547
     etherpadManager
546
         = new EtherpadManager(config.etherpad_base, name, eventEmitter);
548
         = new EtherpadManager(config.etherpad_base, name, eventEmitter);
547
     Toolbar.showEtherpadButton();
549
     Toolbar.showEtherpadButton();
739
 
741
 
740
 // FIXME check if someone user this
742
 // FIXME check if someone user this
741
 UI.showLoginPopup = function(callback) {
743
 UI.showLoginPopup = function(callback) {
742
-    console.log('password is required');
744
+    logger.log('password is required');
743
 
745
 
744
     let message = (
746
     let message = (
745
         `<input name="username" type="text"
747
         `<input name="username" type="text"

+ 8
- 7
modules/UI/authentication/AuthHandler.js 查看文件

1
 /* global APP, config, JitsiMeetJS, Promise */
1
 /* global APP, config, JitsiMeetJS, Promise */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
 
3
 
3
 import LoginDialog from './LoginDialog';
4
 import LoginDialog from './LoginDialog';
4
 import UIUtil from '../util/UIUtil';
5
 import UIUtil from '../util/UIUtil';
74
 function initJWTTokenListener(room) {
75
 function initJWTTokenListener(room) {
75
     var listener = function (event) {
76
     var listener = function (event) {
76
         if (externalAuthWindow !== event.source) {
77
         if (externalAuthWindow !== event.source) {
77
-            console.warn("Ignored message not coming " +
78
+            logger.warn("Ignored message not coming " +
78
                 "from external authnetication window");
79
                 "from external authnetication window");
79
             return;
80
             return;
80
         }
81
         }
81
         if (event.data && event.data.jwtToken) {
82
         if (event.data && event.data.jwtToken) {
82
             config.token = event.data.jwtToken;
83
             config.token = event.data.jwtToken;
83
-            console.info("Received JWT token:", config.token);
84
+            logger.info("Received JWT token:", config.token);
84
             var roomName = room.getName();
85
             var roomName = room.getName();
85
             openConnection({retry: false, roomName: roomName })
86
             openConnection({retry: false, roomName: roomName })
86
                 .then(function (connection) {
87
                 .then(function (connection) {
97
                         // to upgrade user's role
98
                         // to upgrade user's role
98
                         room.room.moderator.authenticate()
99
                         room.room.moderator.authenticate()
99
                             .then(function () {
100
                             .then(function () {
100
-                                console.info("User role upgrade done !");
101
+                                logger.info("User role upgrade done !");
101
                                 unregister();
102
                                 unregister();
102
                             }).catch(function (err, errCode) {
103
                             }).catch(function (err, errCode) {
103
-                                console.error(
104
+                                logger.error(
104
                                     "Authentication failed: ", err, errCode);
105
                                     "Authentication failed: ", err, errCode);
105
                                 unregister();
106
                                 unregister();
106
                             }
107
                             }
108
                     }).catch(function (error, code) {
109
                     }).catch(function (error, code) {
109
                         unregister();
110
                         unregister();
110
                         connection.disconnect();
111
                         connection.disconnect();
111
-                        console.error(
112
+                        logger.error(
112
                             'Authentication failed on the new connection',
113
                             'Authentication failed on the new connection',
113
                             error, code);
114
                             error, code);
114
                     });
115
                     });
115
                 }, function (err) {
116
                 }, function (err) {
116
                     unregister();
117
                     unregister();
117
-                    console.error("Failed to open new connection", err);
118
+                    logger.error("Failed to open new connection", err);
118
                 });
119
                 });
119
         }
120
         }
120
     };
121
     };
161
             }).catch(function (error, code) {
162
             }).catch(function (error, code) {
162
                 connection.disconnect();
163
                 connection.disconnect();
163
 
164
 
164
-                console.error('Auth on the fly failed', error);
165
+                logger.error('Auth on the fly failed', error);
165
 
166
 
166
                 loginDialog.displayError(
167
                 loginDialog.displayError(
167
                     'connection.GET_SESSION_ID_ERROR', {code: code});
168
                     'connection.GET_SESSION_ID_ERROR', {code: code});

+ 2
- 1
modules/UI/avatar/Avatar.js 查看文件

22
  */
22
  */
23
 
23
 
24
 /* global MD5, config, interfaceConfig, APP */
24
 /* global MD5, config, interfaceConfig, APP */
25
+const logger = require("jitsi-meet-logger").getLogger(__filename);
25
 
26
 
26
 let users = {};
27
 let users = {};
27
 
28
 
110
         let random = !avatarId || avatarId.indexOf('@') < 0;
111
         let random = !avatarId || avatarId.indexOf('@') < 0;
111
 
112
 
112
         if (!avatarId) {
113
         if (!avatarId) {
113
-            console.warn(
114
+            logger.warn(
114
                 `No avatar stored yet for ${userId} - using ID as avatar ID`);
115
                 `No avatar stored yet for ${userId} - using ID as avatar ID`);
115
             avatarId = userId;
116
             avatarId = userId;
116
         }
117
         }

+ 2
- 1
modules/UI/invite/Invite.js 查看文件

1
 /* global JitsiMeetJS, APP */
1
 /* global JitsiMeetJS, APP */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
 
3
 
3
 import InviteDialogView from './InviteDialogView';
4
 import InviteDialogView from './InviteDialogView';
4
 import createRoomLocker from './RoomLocker';
5
 import createRoomLocker from './RoomLocker';
28
         this.conference.on(ConferenceEvents.LOCK_STATE_CHANGED,
29
         this.conference.on(ConferenceEvents.LOCK_STATE_CHANGED,
29
             (locked, error) => {
30
             (locked, error) => {
30
 
31
 
31
-            console.log("Received channel password lock change: ", locked,
32
+            logger.log("Received channel password lock change: ", locked,
32
                 error);
33
                 error);
33
 
34
 
34
             if (!locked) {
35
             if (!locked) {

+ 2
- 1
modules/UI/invite/InviteDialogView.js 查看文件

1
 /* global $, APP, JitsiMeetJS */
1
 /* global $, APP, JitsiMeetJS */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
 
3
 
3
 /**
4
 /**
4
  * Substate for password
5
  * Substate for password
312
                     this.blur();
313
                     this.blur();
313
                 }
314
                 }
314
                 catch (err) {
315
                 catch (err) {
315
-                    console.error('error when copy the text');
316
+                    logger.error('error when copy the text');
316
                 }
317
                 }
317
             }
318
             }
318
         });
319
         });

+ 6
- 4
modules/UI/invite/RoomLocker.js 查看文件

1
 /* global APP, JitsiMeetJS */
1
 /* global APP, JitsiMeetJS */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2
 import RequirePasswordDialog from './RequirePasswordDialog';
4
 import RequirePasswordDialog from './RequirePasswordDialog';
3
 
5
 
4
 /**
6
 /**
6
  * because server doesn't support that.
8
  * because server doesn't support that.
7
  */
9
  */
8
 function notifyPasswordNotSupported () {
10
 function notifyPasswordNotSupported () {
9
-    console.warn('room passwords not supported');
11
+    logger.warn('room passwords not supported');
10
     APP.UI.messageHandler.showError(
12
     APP.UI.messageHandler.showError(
11
         "dialog.warning", "dialog.passwordNotSupported");
13
         "dialog.warning", "dialog.passwordNotSupported");
12
 }
14
 }
16
  * @param {Error} err error
18
  * @param {Error} err error
17
  */
19
  */
18
 function notifyPasswordFailed(err) {
20
 function notifyPasswordFailed(err) {
19
-    console.warn('setting password failed', err);
21
+    logger.warn('setting password failed', err);
20
     APP.UI.messageHandler.showError(
22
     APP.UI.messageHandler.showError(
21
         "dialog.lockTitle", "dialog.lockMessage");
23
         "dialog.lockTitle", "dialog.lockMessage");
22
 }
24
 }
64
                 if (!password)
66
                 if (!password)
65
                     lockedElsewhere = false;
67
                     lockedElsewhere = false;
66
             }).catch(function (err) {
68
             }).catch(function (err) {
67
-                console.error(err);
69
+                logger.error(err);
68
                 if (err === ConferenceErrors.PASSWORD_NOT_SUPPORTED) {
70
                 if (err === ConferenceErrors.PASSWORD_NOT_SUPPORTED) {
69
                     notifyPasswordNotSupported();
71
                     notifyPasswordNotSupported();
70
                 } else {
72
                 } else {
113
                     // pass stays between attempts
115
                     // pass stays between attempts
114
                     password = null;
116
                     password = null;
115
                     if (reason !== APP.UI.messageHandler.CANCEL)
117
                     if (reason !== APP.UI.messageHandler.CANCEL)
116
-                        console.error(reason);
118
+                        logger.error(reason);
117
                 }
119
                 }
118
             );
120
             );
119
         },
121
         },

+ 4
- 2
modules/UI/recording/Recording.js 查看文件

14
  * See the License for the specific language governing permissions and
14
  * See the License for the specific language governing permissions and
15
  * limitations under the License.
15
  * limitations under the License.
16
  */
16
  */
17
+const logger = require("jitsi-meet-logger").getLogger(__filename);
18
+
17
 import UIEvents from "../../../service/UI/UIEvents";
19
 import UIEvents from "../../../service/UI/UIEvents";
18
 import UIUtil from '../util/UIUtil';
20
 import UIUtil from '../util/UIUtil';
19
 import VideoLayout from '../videolayout/VideoLayout';
21
 import VideoLayout from '../videolayout/VideoLayout';
327
                         }).catch(
329
                         }).catch(
328
                             reason => {
330
                             reason => {
329
                                 if (reason !== APP.UI.messageHandler.CANCEL)
331
                                 if (reason !== APP.UI.messageHandler.CANCEL)
330
-                                    console.error(reason);
332
+                                    logger.error(reason);
331
                                 else
333
                                 else
332
                                     JitsiMeetJS.analytics.sendEvent(
334
                                     JitsiMeetJS.analytics.sendEvent(
333
                                         'recording.canceled');
335
                                         'recording.canceled');
350
                         }).catch(
352
                         }).catch(
351
                             reason => {
353
                             reason => {
352
                                 if (reason !== APP.UI.messageHandler.CANCEL)
354
                                 if (reason !== APP.UI.messageHandler.CANCEL)
353
-                                    console.error(reason);
355
+                                    logger.error(reason);
354
                                 else
356
                                 else
355
                                     JitsiMeetJS.analytics.sendEvent(
357
                                     JitsiMeetJS.analytics.sendEvent(
356
                                         'recording.canceled');
358
                                         'recording.canceled');

+ 2
- 1
modules/UI/reload_overlay/PageReloadOverlay.js 查看文件

1
 /* global $, APP, AJS */
1
 /* global $, APP, AJS */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
 
3
 
3
 import Overlay from '../overlay/Overlay';
4
 import Overlay from '../overlay/Overlay';
4
 
5
 
84
             }
85
             }
85
         }.bind(this), 1000);
86
         }.bind(this), 1000);
86
 
87
 
87
-        console.info(
88
+        logger.info(
88
             "The conference will be reloaded after "
89
             "The conference will be reloaded after "
89
                 + this.timeLeft + " seconds.");
90
                 + this.timeLeft + " seconds.");
90
     }
91
     }

+ 8
- 7
modules/UI/shared_video/SharedVideo.js 查看文件

1
 /* global $, APP, YT, onPlayerReady, onPlayerStateChange, onPlayerError,
1
 /* global $, APP, YT, onPlayerReady, onPlayerStateChange, onPlayerError,
2
 JitsiMeetJS */
2
 JitsiMeetJS */
3
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
 
4
 
4
 import UIUtil from '../util/UIUtil';
5
 import UIUtil from '../util/UIUtil';
5
 import UIEvents from '../../../service/UI/UIEvents';
6
 import UIEvents from '../../../service/UI/UIEvents';
75
                         JitsiMeetJS.analytics.sendEvent('sharedvideo.started');
76
                         JitsiMeetJS.analytics.sendEvent('sharedvideo.started');
76
                     },
77
                     },
77
                     err => {
78
                     err => {
78
-                        console.log('SHARED VIDEO CANCELED', err);
79
+                        logger.log('SHARED VIDEO CANCELED', err);
79
                         JitsiMeetJS.analytics.sendEvent('sharedvideo.canceled');
80
                         JitsiMeetJS.analytics.sendEvent('sharedvideo.canceled');
80
                     }
81
                     }
81
             );
82
             );
277
         };
278
         };
278
 
279
 
279
         window.onPlayerError = function(event) {
280
         window.onPlayerError = function(event) {
280
-            console.error("Error in the player:", event.data);
281
+            logger.error("Error in the player:", event.data);
281
             // store the error player, so we can remove it
282
             // store the error player, so we can remove it
282
             self.errorInPlayer = event.target;
283
             self.errorInPlayer = event.target;
283
         };
284
         };
313
                 && player.getVolume() != attributes.volume) {
314
                 && player.getVolume() != attributes.volume) {
314
 
315
 
315
                 player.setVolume(attributes.volume);
316
                 player.setVolume(attributes.volume);
316
-                console.info("Player change of volume:" + attributes.volume);
317
+                logger.info("Player change of volume:" + attributes.volume);
317
                 this.showSharedVideoMutedPopup(false);
318
                 this.showSharedVideoMutedPopup(false);
318
             }
319
             }
319
 
320
 
337
     processTime (player, attributes, forceSeek)
338
     processTime (player, attributes, forceSeek)
338
     {
339
     {
339
         if(forceSeek) {
340
         if(forceSeek) {
340
-            console.info("Player seekTo:", attributes.time);
341
+            logger.info("Player seekTo:", attributes.time);
341
             player.seekTo(attributes.time);
342
             player.seekTo(attributes.time);
342
             return;
343
             return;
343
         }
344
         }
349
         // if we drift more than the interval for checking
350
         // if we drift more than the interval for checking
350
         // sync, the interval is in milliseconds
351
         // sync, the interval is in milliseconds
351
         if(diff > updateInterval/1000) {
352
         if(diff > updateInterval/1000) {
352
-            console.info("Player seekTo:", attributes.time,
353
+            logger.info("Player seekTo:", attributes.time,
353
                 " current time is:", currentPosition, " diff:", diff);
354
                 " current time is:", currentPosition, " diff:", diff);
354
             player.seekTo(attributes.time);
355
             player.seekTo(attributes.time);
355
         }
356
         }
669
  * Removes RemoteVideo from the page.
670
  * Removes RemoteVideo from the page.
670
  */
671
  */
671
 SharedVideoThumb.prototype.remove = function () {
672
 SharedVideoThumb.prototype.remove = function () {
672
-    console.log("Remove shared video thumb", this.id);
673
+    logger.log("Remove shared video thumb", this.id);
673
 
674
 
674
     // Make sure that the large video is updated if are removing its
675
     // Make sure that the large video is updated if are removing its
675
     // corresponding small video.
676
     // corresponding small video.
686
  */
687
  */
687
 SharedVideoThumb.prototype.setDisplayName = function(displayName) {
688
 SharedVideoThumb.prototype.setDisplayName = function(displayName) {
688
     if (!this.container) {
689
     if (!this.container) {
689
-        console.warn( "Unable to set displayName - " + this.videoSpanId +
690
+        logger.warn( "Unable to set displayName - " + this.videoSpanId +
690
             " does not exist");
691
             " does not exist");
691
         return;
692
         return;
692
     }
693
     }

+ 3
- 1
modules/UI/side_pannels/contactlist/ContactListView.js 查看文件

1
 /* global $, APP, interfaceConfig */
1
 /* global $, APP, interfaceConfig */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2
 import Avatar from '../../avatar/Avatar';
4
 import Avatar from '../../avatar/Avatar';
3
 import UIEvents from '../../../../service/UI/UIEvents';
5
 import UIEvents from '../../../../service/UI/UIEvents';
4
 import UIUtil from '../../util/UIUtil';
6
 import UIUtil from '../../util/UIUtil';
27
     numberOfContacts += delta;
29
     numberOfContacts += delta;
28
 
30
 
29
     if (numberOfContacts <= 0) {
31
     if (numberOfContacts <= 0) {
30
-        console.error("Invalid number of participants: " + numberOfContacts);
32
+        logger.error("Invalid number of participants: " + numberOfContacts);
31
         return;
33
         return;
32
     }
34
     }
33
 
35
 

+ 3
- 2
modules/UI/util/MessageHandler.js 查看文件

1
 /* global $, APP, toastr */
1
 /* global $, APP, toastr */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
 
3
 
3
 import UIUtil from './UIUtil';
4
 import UIUtil from './UIUtil';
4
 import jitsiLocalStorage from '../../util/JitsiLocalStorage';
5
 import jitsiLocalStorage from '../../util/JitsiLocalStorage';
79
 function dontShowAgainSubmitFunctionWrapper(options, submitFunction) {
80
 function dontShowAgainSubmitFunctionWrapper(options, submitFunction) {
80
     if(isDontShowAgainEnabled(options)) {
81
     if(isDontShowAgainEnabled(options)) {
81
         return (...args) => {
82
         return (...args) => {
82
-            console.debug(args, options.buttonValues);
83
+            logger.debug(args, options.buttonValues);
83
             //args[1] is the value associated with the pressed button
84
             //args[1] is the value associated with the pressed button
84
             if(!options.buttonValues || options.buttonValues.length === 0
85
             if(!options.buttonValues || options.buttonValues.length === 0
85
                 || options.buttonValues.indexOf(args[1]) !== -1 ) {
86
                 || options.buttonValues.indexOf(args[1]) !== -1 ) {
417
      */
418
      */
418
     openReportDialog: function(titleKey, msgKey, error) {
419
     openReportDialog: function(titleKey, msgKey, error) {
419
         this.openMessageDialog(titleKey, msgKey);
420
         this.openMessageDialog(titleKey, msgKey);
420
-        console.log(error);
421
+        logger.log(error);
421
         //FIXME send the error to the server
422
         //FIXME send the error to the server
422
     },
423
     },
423
 
424
 

+ 2
- 1
modules/UI/videolayout/LargeVideoManager.js 查看文件

1
 /* global $, APP, interfaceConfig */
1
 /* global $, APP, interfaceConfig */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
 
3
 
3
 import Avatar from "../avatar/Avatar";
4
 import Avatar from "../avatar/Avatar";
4
 import {createDeferred} from '../../util/helpers';
5
 import {createDeferred} from '../../util/helpers';
126
             const { id, stream, videoType, resolve } = this.newStreamData;
127
             const { id, stream, videoType, resolve } = this.newStreamData;
127
             this.newStreamData = null;
128
             this.newStreamData = null;
128
 
129
 
129
-            console.info("hover in %s", id);
130
+            logger.info("hover in %s", id);
130
             this.state = videoType;
131
             this.state = videoType;
131
             const container = this.getContainer(this.state);
132
             const container = this.getContainer(this.state);
132
             container.setStream(stream, videoType);
133
             container.setStream(stream, videoType);

+ 3
- 1
modules/UI/videolayout/LocalVideo.js 查看文件

1
 /* global $, config, interfaceConfig, APP, JitsiMeetJS */
1
 /* global $, config, interfaceConfig, APP, JitsiMeetJS */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2
 import ConnectionIndicator from "./ConnectionIndicator";
4
 import ConnectionIndicator from "./ConnectionIndicator";
3
 import UIUtil from "../util/UIUtil";
5
 import UIUtil from "../util/UIUtil";
4
 import UIEvents from "../../../service/UI/UIEvents";
6
 import UIEvents from "../../../service/UI/UIEvents";
40
  */
42
  */
41
 LocalVideo.prototype.setDisplayName = function(displayName) {
43
 LocalVideo.prototype.setDisplayName = function(displayName) {
42
     if (!this.container) {
44
     if (!this.container) {
43
-        console.warn(
45
+        logger.warn(
44
                 "Unable to set displayName - " + this.videoSpanId +
46
                 "Unable to set displayName - " + this.videoSpanId +
45
                 " does not exist");
47
                 " does not exist");
46
         return;
48
         return;

+ 6
- 5
modules/UI/videolayout/RemoteVideo.js 查看文件

1
 /* global $, APP, interfaceConfig */
1
 /* global $, APP, interfaceConfig */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
 
3
 
3
 import ConnectionIndicator from './ConnectionIndicator';
4
 import ConnectionIndicator from './ConnectionIndicator';
4
 
5
 
191
         }
192
         }
192
     }).catch(e => {
193
     }).catch(e => {
193
         //currently shouldn't be called
194
         //currently shouldn't be called
194
-        console.error(e);
195
+        logger.error(e);
195
     });
196
     });
196
 
197
 
197
     this.popover.forceHide();
198
     this.popover.forceHide();
343
         this.wasVideoPlayed = false;
344
         this.wasVideoPlayed = false;
344
     }
345
     }
345
 
346
 
346
-    console.info((isVideo ? "Video" : "Audio") +
347
+    logger.info((isVideo ? "Video" : "Audio") +
347
                  " removed " + this.id, select);
348
                  " removed " + this.id, select);
348
 
349
 
349
     // when removing only the video element and we are on stage
350
     // when removing only the video element and we are on stage
408
         }
409
         }
409
     }
410
     }
410
 
411
 
411
-    console.debug(this.id + " thumbnail is connection active ? " + isActive);
412
+    logger.debug(this.id + " thumbnail is connection active ? " + isActive);
412
 
413
 
413
     // Update 'mutedWhileDisconnected' flag
414
     // Update 'mutedWhileDisconnected' flag
414
     this._figureOutMutedWhileDisconnected(!isActive);
415
     this._figureOutMutedWhileDisconnected(!isActive);
427
  * Removes RemoteVideo from the page.
428
  * Removes RemoteVideo from the page.
428
  */
429
  */
429
 RemoteVideo.prototype.remove = function () {
430
 RemoteVideo.prototype.remove = function () {
430
-    console.log("Remove thumbnail", this.id);
431
+    logger.log("Remove thumbnail", this.id);
431
     this.removeConnectionIndicator();
432
     this.removeConnectionIndicator();
432
     // Make sure that the large video is updated if are removing its
433
     // Make sure that the large video is updated if are removing its
433
     // corresponding small video.
434
     // corresponding small video.
586
  */
587
  */
587
 RemoteVideo.prototype.setDisplayName = function(displayName) {
588
 RemoteVideo.prototype.setDisplayName = function(displayName) {
588
     if (!this.container) {
589
     if (!this.container) {
589
-        console.warn( "Unable to set displayName - " + this.videoSpanId +
590
+        logger.warn( "Unable to set displayName - " + this.videoSpanId +
590
                 " does not exist");
591
                 " does not exist");
591
         return;
592
         return;
592
     }
593
     }

+ 5
- 3
modules/UI/videolayout/SmallVideo.js 查看文件

1
 /* global $, JitsiMeetJS, interfaceConfig */
1
 /* global $, JitsiMeetJS, interfaceConfig */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2
 import Avatar from "../avatar/Avatar";
4
 import Avatar from "../avatar/Avatar";
3
 import UIUtil from "../util/UIUtil";
5
 import UIUtil from "../util/UIUtil";
4
 import UIEvents from "../../../service/UI/UIEvents";
6
 import UIEvents from "../../../service/UI/UIEvents";
497
             // Init avatar
499
             // Init avatar
498
             this.avatarChanged(Avatar.getAvatarUrl(this.id));
500
             this.avatarChanged(Avatar.getAvatarUrl(this.id));
499
         } else {
501
         } else {
500
-            console.error("Unable to init avatar - no id", this);
502
+            logger.error("Unable to init avatar - no id", this);
501
             return;
503
             return;
502
         }
504
         }
503
     }
505
     }
555
         return;
557
         return;
556
 
558
 
557
     if (!this.container) {
559
     if (!this.container) {
558
-        console.warn( "Unable to set dominant speaker indicator - "
560
+        logger.warn( "Unable to set dominant speaker indicator - "
559
             + this.videoSpanId + " does not exist");
561
             + this.videoSpanId + " does not exist");
560
         return;
562
         return;
561
     }
563
     }
579
  */
581
  */
580
 SmallVideo.prototype.showRaisedHandIndicator = function (show) {
582
 SmallVideo.prototype.showRaisedHandIndicator = function (show) {
581
     if (!this.container) {
583
     if (!this.container) {
582
-        console.warn( "Unable to raised hand indication - "
584
+        logger.warn( "Unable to raised hand indication - "
583
             + this.videoSpanId + " does not exist");
585
             + this.videoSpanId + " does not exist");
584
         return;
586
         return;
585
     }
587
     }

+ 19
- 18
modules/UI/videolayout/VideoLayout.js 查看文件

1
 /* global config, APP, $, interfaceConfig */
1
 /* global config, APP, $, interfaceConfig */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
 
3
 
3
 import FilmStrip from "./FilmStrip";
4
 import FilmStrip from "./FilmStrip";
4
 import UIEvents from "../../../service/UI/UIEvents";
5
 import UIEvents from "../../../service/UI/UIEvents";
261
         if (lastVisible.length) {
262
         if (lastVisible.length) {
262
             let id = getPeerContainerResourceId(lastVisible[0]);
263
             let id = getPeerContainerResourceId(lastVisible[0]);
263
             if (remoteVideos[id]) {
264
             if (remoteVideos[id]) {
264
-                console.info("electLastVisibleVideo: " + id);
265
+                logger.info("electLastVisibleVideo: " + id);
265
                 return id;
266
                 return id;
266
             }
267
             }
267
             // The RemoteVideo was removed (but the DOM elements may still
268
             // The RemoteVideo was removed (but the DOM elements may still
268
             // exist).
269
             // exist).
269
         }
270
         }
270
 
271
 
271
-        console.info("Last visible video no longer exists");
272
+        logger.info("Last visible video no longer exists");
272
         thumbs = FilmStrip.getThumbs().remoteThumbs;
273
         thumbs = FilmStrip.getThumbs().remoteThumbs;
273
         if (thumbs.length) {
274
         if (thumbs.length) {
274
             let id = getPeerContainerResourceId(thumbs[0]);
275
             let id = getPeerContainerResourceId(thumbs[0]);
275
             if (remoteVideos[id]) {
276
             if (remoteVideos[id]) {
276
-                console.info("electLastVisibleVideo: " + id);
277
+                logger.info("electLastVisibleVideo: " + id);
277
                 return id;
278
                 return id;
278
             }
279
             }
279
             // The RemoteVideo was removed (but the DOM elements may
280
             // The RemoteVideo was removed (but the DOM elements may
281
         }
282
         }
282
 
283
 
283
         // Go with local video
284
         // Go with local video
284
-        console.info("Fallback to local video...");
285
+        logger.info("Fallback to local video...");
285
 
286
 
286
         let id = APP.conference.getMyUserId();
287
         let id = APP.conference.getMyUserId();
287
-        console.info("electLastVisibleVideo: " + id);
288
+        logger.info("electLastVisibleVideo: " + id);
288
 
289
 
289
         return id;
290
         return id;
290
     },
291
     },
438
     // FIXME: what does this do???
439
     // FIXME: what does this do???
439
     remoteVideoActive(videoElement, resourceJid) {
440
     remoteVideoActive(videoElement, resourceJid) {
440
 
441
 
441
-        console.info(resourceJid + " video is now active", videoElement);
442
+        logger.info(resourceJid + " video is now active", videoElement);
442
 
443
 
443
         VideoLayout.resizeThumbnails(
444
         VideoLayout.resizeThumbnails(
444
             false, false, function() {$(videoElement).show();});
445
             false, false, function() {$(videoElement).show();});
736
             if (resourceJid &&
737
             if (resourceJid &&
737
                 lastNEndpoints.indexOf(resourceJid) < 0 &&
738
                 lastNEndpoints.indexOf(resourceJid) < 0 &&
738
                 localLastNSet.indexOf(resourceJid) < 0) {
739
                 localLastNSet.indexOf(resourceJid) < 0) {
739
-                console.log("Remove from last N", resourceJid);
740
+                logger.log("Remove from last N", resourceJid);
740
                 if (smallVideo)
741
                 if (smallVideo)
741
                     smallVideo.showPeerContainer('hide');
742
                     smallVideo.showPeerContainer('hide');
742
                 else if (!APP.conference.isLocalId(resourceJid))
743
                 else if (!APP.conference.isLocalId(resourceJid))
743
-                    console.error("No remote video for: " + resourceJid);
744
+                    logger.error("No remote video for: " + resourceJid);
744
                 isReceived = false;
745
                 isReceived = false;
745
             } else if (resourceJid &&
746
             } else if (resourceJid &&
746
                 //TOFIX: smallVideo may be undefined
747
                 //TOFIX: smallVideo may be undefined
753
                 if (smallVideo)
754
                 if (smallVideo)
754
                     smallVideo.showPeerContainer('avatar');
755
                     smallVideo.showPeerContainer('avatar');
755
                 else if (!APP.conference.isLocalId(resourceJid))
756
                 else if (!APP.conference.isLocalId(resourceJid))
756
-                    console.error("No remote video for: " + resourceJid);
757
+                    logger.error("No remote video for: " + resourceJid);
757
                 isReceived = false;
758
                 isReceived = false;
758
             }
759
             }
759
 
760
 
780
                     remoteVideo.showPeerContainer('show');
781
                     remoteVideo.showPeerContainer('show');
781
 
782
 
782
                 if (!remoteVideo.isVisible()) {
783
                 if (!remoteVideo.isVisible()) {
783
-                    console.log("Add to last N", resourceJid);
784
+                    logger.log("Add to last N", resourceJid);
784
 
785
 
785
                     remoteVideo.addRemoteStreamElement(remoteVideo.videoStream);
786
                     remoteVideo.addRemoteStreamElement(remoteVideo.videoStream);
786
 
787
 
881
     removeParticipantContainer (id) {
882
     removeParticipantContainer (id) {
882
         // Unlock large video
883
         // Unlock large video
883
         if (pinnedId === id) {
884
         if (pinnedId === id) {
884
-            console.info("Focused video owner has left the conference");
885
+            logger.info("Focused video owner has left the conference");
885
             pinnedId = null;
886
             pinnedId = null;
886
         }
887
         }
887
 
888
 
888
         if (currentDominantSpeaker === id) {
889
         if (currentDominantSpeaker === id) {
889
-            console.info("Dominant speaker has left the conference");
890
+            logger.info("Dominant speaker has left the conference");
890
             currentDominantSpeaker = null;
891
             currentDominantSpeaker = null;
891
         }
892
         }
892
 
893
 
893
         var remoteVideo = remoteVideos[id];
894
         var remoteVideo = remoteVideos[id];
894
         if (remoteVideo) {
895
         if (remoteVideo) {
895
             // Remove remote video
896
             // Remove remote video
896
-            console.info("Removing remote video: " + id);
897
+            logger.info("Removing remote video: " + id);
897
             delete remoteVideos[id];
898
             delete remoteVideos[id];
898
             remoteVideo.remove();
899
             remoteVideo.remove();
899
         } else {
900
         } else {
900
-            console.warn("No remote video for " + id);
901
+            logger.warn("No remote video for " + id);
901
         }
902
         }
902
 
903
 
903
         VideoLayout.resizeThumbnails();
904
         VideoLayout.resizeThumbnails();
908
             return;
909
             return;
909
         }
910
         }
910
 
911
 
911
-        console.info("Peer video type changed: ", id, newVideoType);
912
+        logger.info("Peer video type changed: ", id, newVideoType);
912
 
913
 
913
         var smallVideo;
914
         var smallVideo;
914
         if (APP.conference.isLocalId(id)) {
915
         if (APP.conference.isLocalId(id)) {
915
             if (!localVideoThumbnail) {
916
             if (!localVideoThumbnail) {
916
-                console.warn("Local video not ready yet");
917
+                logger.warn("Local video not ready yet");
917
                 return;
918
                 return;
918
             }
919
             }
919
             smallVideo = localVideoThumbnail;
920
             smallVideo = localVideoThumbnail;
937
             if (remoteVideo) {
938
             if (remoteVideo) {
938
                 remoteVideo.connectionIndicator.showMore();
939
                 remoteVideo.connectionIndicator.showMore();
939
             } else {
940
             } else {
940
-                console.info("Error - no remote video for id: " + id);
941
+                logger.info("Error - no remote video for id: " + id);
941
             }
942
             }
942
         }
943
         }
943
     },
944
     },
994
         if (smallVideo) {
995
         if (smallVideo) {
995
             smallVideo.avatarChanged(avatarUrl);
996
             smallVideo.avatarChanged(avatarUrl);
996
         } else {
997
         } else {
997
-            console.warn(
998
+            logger.warn(
998
                 "Missed avatar update - no small video yet for " + id
999
                 "Missed avatar update - no small video yet for " + id
999
             );
1000
             );
1000
         }
1001
         }

+ 4
- 4
modules/URL/ConferenceUrl.js 查看文件

1
-/* global console */
1
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
 
2
 
3
 import { redirect } from '../util/helpers';
3
 import { redirect } from '../util/helpers';
4
 
4
 
45
          */
45
          */
46
         this.inviteURL
46
         this.inviteURL
47
             = location.protocol + "//" + location.host + location.pathname;
47
             = location.protocol + "//" + location.host + location.pathname;
48
-        console.info("Stored original conference URL: " + this.originalURL);
49
-        console.info("Conference URL for invites: " + this.inviteURL);
48
+        logger.info("Stored original conference URL: " + this.originalURL);
49
+        logger.info("Conference URL for invites: " + this.inviteURL);
50
     }
50
     }
51
     /**
51
     /**
52
      * Obtains the conference invite URL.
52
      * Obtains the conference invite URL.
67
      * Reloads the conference using original URL with all of the parameters.
67
      * Reloads the conference using original URL with all of the parameters.
68
      */
68
      */
69
     reload() {
69
     reload() {
70
-        console.info("Reloading the conference using URL: " + this.originalURL);
70
+        logger.info("Reloading the conference using URL: " + this.originalURL);
71
         redirect(this.originalURL);
71
         redirect(this.originalURL);
72
     }
72
     }
73
 }
73
 }

+ 5
- 3
modules/config/BoshAddressChoice.js 查看文件

1
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
+
1
 var JSSHA = require('jssha');
3
 var JSSHA = require('jssha');
2
 
4
 
3
 module.exports = {
5
 module.exports = {
22
         var attemptFirstAddress;
24
         var attemptFirstAddress;
23
 
25
 
24
         config.bosh = config.boshList[idx];
26
         config.bosh = config.boshList[idx];
25
-        console.log('Setting config.bosh to ' + config.bosh +
27
+        logger.log('Setting config.bosh to ' + config.bosh +
26
             ' (idx=' + idx + ')');
28
             ' (idx=' + idx + ')');
27
 
29
 
28
         if (config.boshAttemptFirstList &&
30
         if (config.boshAttemptFirstList &&
34
 
36
 
35
             if (attemptFirstAddress != config.bosh) {
37
             if (attemptFirstAddress != config.bosh) {
36
                 config.boshAttemptFirst = attemptFirstAddress;
38
                 config.boshAttemptFirst = attemptFirstAddress;
37
-                console.log('Setting config.boshAttemptFirst=' +
39
+                logger.log('Setting config.boshAttemptFirst=' +
38
                     attemptFirstAddress + ' (idx=' + idx + ')');
40
                     attemptFirstAddress + ' (idx=' + idx + ')');
39
             } else {
41
             } else {
40
-                console.log('Not setting boshAttemptFirst, address matches.');
42
+                logger.log('Not setting boshAttemptFirst, address matches.');
41
             }
43
             }
42
         }
44
         }
43
     }
45
     }

+ 4
- 3
modules/config/HttpConfigFetch.js 查看文件

1
 /* global $, config, interfaceConfig */
1
 /* global $, config, interfaceConfig */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
 
3
 
3
 var configUtil = require('./Util');
4
 var configUtil = require('./Util');
4
 
5
 
16
      * @param complete
17
      * @param complete
17
      */
18
      */
18
     obtainConfig: function (endpoint, roomName, complete) {
19
     obtainConfig: function (endpoint, roomName, complete) {
19
-        console.info(
20
+        logger.info(
20
             "Send config request to " + endpoint + " for room: " + roomName);
21
             "Send config request to " + endpoint + " for room: " + roomName);
21
 
22
 
22
 
23
 
28
                 data: JSON.stringify({"roomName": roomName}),
29
                 data: JSON.stringify({"roomName": roomName}),
29
                 dataType: 'json',
30
                 dataType: 'json',
30
                 error: function(jqXHR, textStatus, errorThrown) {
31
                 error: function(jqXHR, textStatus, errorThrown) {
31
-                    console.error("Get config error: ", jqXHR, errorThrown);
32
+                    logger.error("Get config error: ", jqXHR, errorThrown);
32
                     var error = "Get config response status: " + textStatus;
33
                     var error = "Get config response status: " + textStatus;
33
                     complete(false, error);
34
                     complete(false, error);
34
                 },
35
                 },
39
                         complete(true);
40
                         complete(true);
40
                         return;
41
                         return;
41
                     } catch (exception) {
42
                     } catch (exception) {
42
-                        console.error("Parse config error: ", exception);
43
+                        logger.error("Parse config error: ", exception);
43
                         complete(false, exception);
44
                         complete(false, exception);
44
                     }
45
                     }
45
                 }
46
                 }

+ 11
- 4
modules/config/URLProcessor.js 查看文件

1
-/* global config, interfaceConfig, getConfigParamsFromUrl */
1
+/* global config, interfaceConfig, loggingConfig, getConfigParamsFromUrl */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2
 var configUtils = require('./Util');
4
 var configUtils = require('./Util');
3
 var params = {};
5
 var params = {};
4
 
6
 
25
         // }
27
         // }
26
         var configJSON = {
28
         var configJSON = {
27
             config: {},
29
             config: {},
28
-            interfaceConfig: {}
30
+            interfaceConfig: {},
31
+            loggingConfig: {}
29
         };
32
         };
30
         for (var key in params) {
33
         for (var key in params) {
31
             if (typeof key !== "string") {
34
             if (typeof key !== "string") {
32
-                console.warn("Invalid config key: ", key);
35
+                logger.warn("Invalid config key: ", key);
33
                 continue;
36
                 continue;
34
             }
37
             }
35
             var confObj = null, confKey;
38
             var confObj = null, confKey;
45
             } else if (key.indexOf("interfaceConfig.") === 0) {
48
             } else if (key.indexOf("interfaceConfig.") === 0) {
46
                 confObj = configJSON.interfaceConfig;
49
                 confObj = configJSON.interfaceConfig;
47
                 confKey = key.substr("interfaceConfig.".length);
50
                 confKey = key.substr("interfaceConfig.".length);
51
+            } else if (key.indexOf("loggingConfig.") === 0) {
52
+                confObj = configJSON.loggingConfig;
53
+                confKey = key.substr("loggingConfig.".length);
48
             }
54
             }
49
 
55
 
50
             if (!confObj)
56
             if (!confObj)
52
 
58
 
53
             confObj[confKey] = params[key];
59
             confObj[confKey] = params[key];
54
         }
60
         }
55
-        configUtils.overrideConfigJSON(config, interfaceConfig, configJSON);
61
+        configUtils.overrideConfigJSON(
62
+            config, interfaceConfig, loggingConfig, configJSON);
56
     }
63
     }
57
 };
64
 };
58
 
65
 

+ 14
- 4
modules/config/Util.js 查看文件

1
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
+
1
 var ConfigUtil = {
3
 var ConfigUtil = {
2
     /**
4
     /**
3
      * Method overrides JSON properties in <tt>config</tt> and
5
      * Method overrides JSON properties in <tt>config</tt> and
5
      * @param config the config object for which we'll be overriding properties
7
      * @param config the config object for which we'll be overriding properties
6
      * @param interfaceConfig the interfaceConfig object for which we'll be
8
      * @param interfaceConfig the interfaceConfig object for which we'll be
7
      *                        overriding properties.
9
      *                        overriding properties.
10
+     * @param loggingConfig the logging config object for which we'll be
11
+     *        overriding properties.
8
      * @param newConfig object containing configuration properties. Destination
12
      * @param newConfig object containing configuration properties. Destination
9
      *        object is selected based on root property name:
13
      *        object is selected based on root property name:
10
      *        {
14
      *        {
12
      *             // config.js properties to be
16
      *             // config.js properties to be
13
      *          },
17
      *          },
14
      *          interfaceConfig: {
18
      *          interfaceConfig: {
15
-     *             // interfaceConfig.js properties here
19
+     *             // interface_config.js properties here
20
+     *          },
21
+     *          loggingConfig: {
22
+     *             // logging_config.js properties here
16
      *          }
23
      *          }
17
      *        }
24
      *        }
18
      */
25
      */
19
-    overrideConfigJSON: function (config, interfaceConfig, newConfig) {
26
+    overrideConfigJSON: function (config,
27
+                                  interfaceConfig, loggingConfig, newConfig) {
20
         var configRoot, key, value, confObj;
28
         var configRoot, key, value, confObj;
21
         for (configRoot in newConfig) {
29
         for (configRoot in newConfig) {
22
             confObj = null;
30
             confObj = null;
24
                 confObj = config;
32
                 confObj = config;
25
             } else if (configRoot == "interfaceConfig") {
33
             } else if (configRoot == "interfaceConfig") {
26
                 confObj = interfaceConfig;
34
                 confObj = interfaceConfig;
35
+            } else if (configRoot == "loggingConfig") {
36
+                confObj = loggingConfig;
27
             } else {
37
             } else {
28
                 continue;
38
                 continue;
29
             }
39
             }
31
             for (key in newConfig[configRoot]) {
41
             for (key in newConfig[configRoot]) {
32
                 value = newConfig[configRoot][key];
42
                 value = newConfig[configRoot][key];
33
                 if (confObj[key] && typeof confObj[key] !== typeof value) {
43
                 if (confObj[key] && typeof confObj[key] !== typeof value) {
34
-                    console.log("Overriding a " + configRoot +
44
+                    logger.log("Overriding a " + configRoot +
35
                         " property with a property of different type.");
45
                         " property with a property of different type.");
36
                 }
46
                 }
37
-                console.info("Overriding " + key + " with: " + value);
47
+                logger.info("Overriding " + key + " with: " + value);
38
                 confObj[key] = value;
48
                 confObj[key] = value;
39
             }
49
             }
40
         }
50
         }

+ 3
- 1
modules/settings/Settings.js 查看文件

1
 /* global JitsiMeetJS */
1
 /* global JitsiMeetJS */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2
 import UIUtil from '../UI/util/UIUtil';
4
 import UIUtil from '../UI/util/UIUtil';
3
 import jitsiLocalStorage from '../util/JitsiLocalStorage';
5
 import jitsiLocalStorage from '../util/JitsiLocalStorage';
4
 
6
 
37
     JitsiMeetJS.mediaDevices.getAudioOutputDevice()) {
39
     JitsiMeetJS.mediaDevices.getAudioOutputDevice()) {
38
     JitsiMeetJS.mediaDevices.setAudioOutputDevice(audioOutputDeviceId)
40
     JitsiMeetJS.mediaDevices.setAudioOutputDevice(audioOutputDeviceId)
39
         .catch((ex) => {
41
         .catch((ex) => {
40
-            console.warn('Failed to set audio output device from local ' +
42
+            logger.warn('Failed to set audio output device from local ' +
41
                 'storage. Default audio output device will be used' +
43
                 'storage. Default audio output device will be used' +
42
                 'instead.', ex);
44
                 'instead.', ex);
43
         });
45
         });

+ 66
- 0
modules/util/JitsiMeetLogStorage.js 查看文件

1
+/* global APP */
2
+
3
+/**
4
+ * Implements logs storage through the CallStats.
5
+ */
6
+export default class JitsiMeetLogStorage {
7
+
8
+    /**
9
+     * Creates new <tt>JitsiMeetLogStorage</tt>
10
+     */
11
+    constructor() {
12
+        /**
13
+         * Counts each log entry, increases on every batch log entry stored.
14
+         * @type {number}
15
+         */
16
+        this.counter = 1;
17
+    }
18
+
19
+    /**
20
+     * @return {boolean} <tt>true</tt> when this storage is ready or
21
+     * <tt>false</tt> otherwise.
22
+     */
23
+    isReady() {
24
+        return APP.logCollectorStarted && APP.conference;
25
+    }
26
+
27
+    /**
28
+     * Called by the <tt>LogCollector</tt> to store a series of log lines into
29
+     * batch.
30
+     * @param {string|object[]}logEntries an array containing strings
31
+     * representing log lines or aggregated lines objects.
32
+     */
33
+    storeLogs(logEntries) {
34
+
35
+        if (!APP.conference.isCallstatsEnabled()) {
36
+            // Discard the logs if CallStats is not enabled.
37
+            return;
38
+        }
39
+
40
+        let logJSON = '{"log' + this.counter + '":"\n';
41
+        for (let i = 0, len = logEntries.length; i < len; i++) {
42
+            let logEntry = logEntries[i];
43
+            if (typeof logEntry === 'object') {
44
+                // Aggregated message
45
+                logJSON += '(' + logEntry.count + ') ' + logEntry.text + '\n';
46
+            } else {
47
+                // Regular message
48
+                logJSON += logEntry + '\n';
49
+            }
50
+        }
51
+        logJSON += '"}';
52
+
53
+        this.counter += 1;
54
+
55
+        // Try catch was used, because there are many variables
56
+        // on the way that could be uninitialized if the storeLogs
57
+        // attempt would be made very early (which is unlikely)
58
+        try {
59
+            APP.conference.logJSON(logJSON);
60
+        } catch (error) {
61
+            // NOTE console is intentional here
62
+            console.error(
63
+                "Failed to store the logs: ", logJSON, error);
64
+        }
65
+    }
66
+}

+ 3
- 1
modules/util/helpers.js 查看文件

1
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
+
1
 /**
3
 /**
2
  * Create deferred object.
4
  * Create deferred object.
3
  * @returns {{promise, resolve, reject}}
5
  * @returns {{promise, resolve, reject}}
35
  * @param msg {string} [optional] the message printed in addition to the error
37
  * @param msg {string} [optional] the message printed in addition to the error
36
  */
38
  */
37
 export function reportError (e, msg = "") {
39
 export function reportError (e, msg = "") {
38
-    console.error(msg, e);
40
+    logger.error(msg, e);
39
     if(window.onerror)
41
     if(window.onerror)
40
         window.onerror(msg, null, null,
42
         window.onerror(msg, null, null,
41
             null, e);
43
             null, e);

+ 1
- 0
package.json 查看文件

22
     "bootstrap": "3.1.1",
22
     "bootstrap": "3.1.1",
23
     "i18next": "3.4.4",
23
     "i18next": "3.4.4",
24
     "i18next-xhr-backend": "1.1.0",
24
     "i18next-xhr-backend": "1.1.0",
25
+    "jitsi-meet-logger": "jitsi/jitsi-meet-logger",
25
     "jquery": "~2.1.1",
26
     "jquery": "~2.1.1",
26
     "jquery-contextmenu": "*",
27
     "jquery-contextmenu": "*",
27
     "jquery-i18next": "1.1.0",
28
     "jquery-i18next": "1.1.0",

Loading…
取消
儲存