ソースを参照

Merge pull request #1158 from jitsi/log_collector

Log collector
j8
hristoterezov 8年前
コミット
8745efb81f

+ 102
- 6
app.js ファイルの表示

@@ -1,5 +1,6 @@
1
-/* global $, config, getRoomName */
1
+/* global $, config, getRoomName, loggingConfig, JitsiMeetJS */
2 2
 /* application specific logic */
3
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3 4
 
4 5
 import "babel-polyfill";
5 6
 import "jquery";
@@ -18,6 +19,10 @@ import 'aui-experimental-css';
18 19
 
19 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 26
 import URLProcessor from "./modules/config/URLProcessor";
22 27
 import RoomnameGenerator from './modules/util/RoomnameGenerator';
23 28
 
@@ -31,6 +36,8 @@ import UIEvents from './service/UI/UIEvents';
31 36
 import getTokenData from "./modules/tokendata/TokenData";
32 37
 import translation from "./modules/translation/translation";
33 38
 
39
+const ConferenceEvents = JitsiMeetJS.events.conference;
40
+
34 41
 /**
35 42
  * Tries to push history state with the following parameters:
36 43
  * 'VideoChat', `Room: ${roomName}`, URL. If fail, prints the error and returns
@@ -42,7 +49,7 @@ function pushHistoryState(roomName, URL) {
42 49
             'VideoChat', `Room: ${roomName}`, URL
43 50
         );
44 51
     } catch (e) {
45
-        console.warn("Push history state failed with parameters:",
52
+        logger.warn("Push history state failed with parameters:",
46 53
             'VideoChat', `Room: ${roomName}`, URL, e);
47 54
         return e;
48 55
     }
@@ -78,6 +85,36 @@ function buildRoomName () {
78 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 118
 const APP = {
82 119
     // Used by do_external_connect.js if we receive the attach data after
83 120
     // connect was already executed. status property can be "initialized",
@@ -97,6 +134,16 @@ const APP = {
97 134
     settings,
98 135
     conference,
99 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 148
      * After the APP has been initialized provides utility methods for dealing
102 149
      * with the conference room URL(address).
@@ -106,10 +153,24 @@ const APP = {
106 153
     connection: null,
107 154
     API,
108 155
     init () {
156
+        this.initLogging();
109 157
         this.keyboardshortcut =
110 158
             require("./modules/keyboardshortcut/keyboardshortcut");
111 159
         this.configFetch = require("./modules/config/HttpConfigFetch");
112 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,9 +192,39 @@ function init() {
131 192
     APP.ConferenceUrl = new ConferenceUrl(window.location);
132 193
     // Clean up the URL displayed by the browser
133 194
     replaceHistoryState(APP.ConferenceUrl.getInviteUrl());
134
-    var isUIReady = APP.UI.start();
195
+    const isUIReady = APP.UI.start();
135 196
     if (isUIReady) {
136 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 228
             APP.UI.initConference();
138 229
 
139 230
             APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) {
@@ -145,7 +236,7 @@ function init() {
145 236
         }).catch(function (err) {
146 237
             APP.UI.hideRingOverLay();
147 238
             APP.API.notifyConferenceLeft(APP.conference.roomName);
148
-            console.error(err);
239
+            logger.error(err);
149 240
         });
150 241
     }
151 242
 }
@@ -169,7 +260,7 @@ function obtainConfigAndInit() {
169 260
                 if (success) {
170 261
                     var now = APP.connectionTimes["configuration.fetched"] =
171 262
                         window.performance.now();
172
-                    console.log("(TIME) configuration fetched:\t", now);
263
+                    logger.log("(TIME) configuration fetched:\t", now);
173 264
                     init();
174 265
                 } else {
175 266
                     // Show obtain config error,
@@ -189,7 +280,7 @@ function obtainConfigAndInit() {
189 280
 
190 281
 $(document).ready(function () {
191 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 285
     URLProcessor.setConfigParametersFromUrl();
195 286
 
@@ -211,6 +302,11 @@ $(document).ready(function () {
211 302
 });
212 303
 
213 304
 $(window).bind('beforeunload', function () {
305
+    // Stop the LogCollector
306
+    if (APP.logCollectorStarted) {
307
+        APP.logCollector.stop();
308
+        APP.logCollectorStarted = false;
309
+    }
214 310
     APP.API.dispose();
215 311
 });
216 312
 

+ 34
- 25
conference.js ファイルの表示

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

+ 3
- 1
connection.js ファイルの表示

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

+ 2
- 0
index.html ファイルの表示

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

+ 10
- 0
logging_config.js ファイルの表示

@@ -0,0 +1,10 @@
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,4 +1,6 @@
1 1
 /* global APP, getConfigParamsFromUrl */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2 4
 /**
3 5
  * Implements API class that communicates with external api class
4 6
  * and provides interface to access Jitsi Meet features by external
@@ -131,13 +133,13 @@ function onSystemMessage(message) {
131 133
     switch (message.type) {
132 134
         case "eventStatus":
133 135
             if(!message.name || !message.value) {
134
-                console.warn("Unknown system message format", message);
136
+                logger.warn("Unknown system message format", message);
135 137
                 break;
136 138
             }
137 139
             events[message.name] = message.value;
138 140
             break;
139 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,3 +1,5 @@
1
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
+
1 3
 /**
2 4
  * Implements API class that embeds Jitsi Meet in external applications.
3 5
  */
@@ -72,7 +74,7 @@ function sendMessage(postis, object) {
72 74
  */
73 75
 function changeEventStatus(postis, event, status) {
74 76
     if(!(event in events)) {
75
-        console.error("Not supported event name.");
77
+        logger.error("Not supported event name.");
76 78
         return;
77 79
     }
78 80
     sendMessage(postis, {
@@ -174,7 +176,7 @@ function JitsiMeetExternalAPI(domain, room_name, width, height, parentNode,
174 176
  */
175 177
 JitsiMeetExternalAPI.prototype.executeCommand = function(name, argumentsList) {
176 178
     if(!(name in commands)) {
177
-        console.error("Not supported command name.");
179
+        logger.error("Not supported command name.");
178 180
         return;
179 181
     }
180 182
     var argumentsArray = argumentsList;
@@ -306,7 +308,7 @@ JitsiMeetExternalAPI.prototype.addEventListeners = function(object) {
306 308
  */
307 309
 JitsiMeetExternalAPI.prototype.addEventListener = function(event, listener) {
308 310
     if(!(event in events)) {
309
-        console.error("Not supported event name.");
311
+        logger.error("Not supported event name.");
310 312
         return;
311 313
     }
312 314
     // We cannot remove listeners from postis that's why we are handling the
@@ -328,7 +330,7 @@ JitsiMeetExternalAPI.prototype.addEventListener = function(event, listener) {
328 330
 JitsiMeetExternalAPI.prototype.removeEventListener = function(event) {
329 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 334
         return;
333 335
     }
334 336
     delete this.eventHandlers[event];

+ 2
- 1
modules/FollowMe.js ファイルの表示

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

+ 5
- 3
modules/UI/UI.js ファイルの表示

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

+ 8
- 7
modules/UI/authentication/AuthHandler.js ファイルの表示

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

+ 2
- 1
modules/UI/avatar/Avatar.js ファイルの表示

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

+ 2
- 1
modules/UI/invite/Invite.js ファイルの表示

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

+ 2
- 1
modules/UI/invite/InviteDialogView.js ファイルの表示

@@ -1,4 +1,5 @@
1 1
 /* global $, APP, JitsiMeetJS */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2 3
 
3 4
 /**
4 5
  * Substate for password
@@ -312,7 +313,7 @@ export default class InviteDialogView {
312 313
                     this.blur();
313 314
                 }
314 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,4 +1,6 @@
1 1
 /* global APP, JitsiMeetJS */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2 4
 import RequirePasswordDialog from './RequirePasswordDialog';
3 5
 
4 6
 /**
@@ -6,7 +8,7 @@ import RequirePasswordDialog from './RequirePasswordDialog';
6 8
  * because server doesn't support that.
7 9
  */
8 10
 function notifyPasswordNotSupported () {
9
-    console.warn('room passwords not supported');
11
+    logger.warn('room passwords not supported');
10 12
     APP.UI.messageHandler.showError(
11 13
         "dialog.warning", "dialog.passwordNotSupported");
12 14
 }
@@ -16,7 +18,7 @@ function notifyPasswordNotSupported () {
16 18
  * @param {Error} err error
17 19
  */
18 20
 function notifyPasswordFailed(err) {
19
-    console.warn('setting password failed', err);
21
+    logger.warn('setting password failed', err);
20 22
     APP.UI.messageHandler.showError(
21 23
         "dialog.lockTitle", "dialog.lockMessage");
22 24
 }
@@ -64,7 +66,7 @@ export default function createRoomLocker (room) {
64 66
                 if (!password)
65 67
                     lockedElsewhere = false;
66 68
             }).catch(function (err) {
67
-                console.error(err);
69
+                logger.error(err);
68 70
                 if (err === ConferenceErrors.PASSWORD_NOT_SUPPORTED) {
69 71
                     notifyPasswordNotSupported();
70 72
                 } else {
@@ -113,7 +115,7 @@ export default function createRoomLocker (room) {
113 115
                     // pass stays between attempts
114 116
                     password = null;
115 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,6 +14,8 @@
14 14
  * See the License for the specific language governing permissions and
15 15
  * limitations under the License.
16 16
  */
17
+const logger = require("jitsi-meet-logger").getLogger(__filename);
18
+
17 19
 import UIEvents from "../../../service/UI/UIEvents";
18 20
 import UIUtil from '../util/UIUtil';
19 21
 import VideoLayout from '../videolayout/VideoLayout';
@@ -327,7 +329,7 @@ var Recording = {
327 329
                         }).catch(
328 330
                             reason => {
329 331
                                 if (reason !== APP.UI.messageHandler.CANCEL)
330
-                                    console.error(reason);
332
+                                    logger.error(reason);
331 333
                                 else
332 334
                                     JitsiMeetJS.analytics.sendEvent(
333 335
                                         'recording.canceled');
@@ -350,7 +352,7 @@ var Recording = {
350 352
                         }).catch(
351 353
                             reason => {
352 354
                                 if (reason !== APP.UI.messageHandler.CANCEL)
353
-                                    console.error(reason);
355
+                                    logger.error(reason);
354 356
                                 else
355 357
                                     JitsiMeetJS.analytics.sendEvent(
356 358
                                         'recording.canceled');

+ 2
- 1
modules/UI/reload_overlay/PageReloadOverlay.js ファイルの表示

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

+ 8
- 7
modules/UI/shared_video/SharedVideo.js ファイルの表示

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

+ 3
- 1
modules/UI/side_pannels/contactlist/ContactListView.js ファイルの表示

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

+ 3
- 2
modules/UI/util/MessageHandler.js ファイルの表示

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

+ 2
- 1
modules/UI/videolayout/LargeVideoManager.js ファイルの表示

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

+ 3
- 1
modules/UI/videolayout/LocalVideo.js ファイルの表示

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

+ 6
- 5
modules/UI/videolayout/RemoteVideo.js ファイルの表示

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

+ 5
- 3
modules/UI/videolayout/SmallVideo.js ファイルの表示

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

+ 19
- 18
modules/UI/videolayout/VideoLayout.js ファイルの表示

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

+ 4
- 4
modules/URL/ConferenceUrl.js ファイルの表示

@@ -1,4 +1,4 @@
1
-/* global console */
1
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2 2
 
3 3
 import { redirect } from '../util/helpers';
4 4
 
@@ -45,8 +45,8 @@ export default class ConferenceUrl {
45 45
          */
46 46
         this.inviteURL
47 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 52
      * Obtains the conference invite URL.
@@ -67,7 +67,7 @@ export default class ConferenceUrl {
67 67
      * Reloads the conference using original URL with all of the parameters.
68 68
      */
69 69
     reload() {
70
-        console.info("Reloading the conference using URL: " + this.originalURL);
70
+        logger.info("Reloading the conference using URL: " + this.originalURL);
71 71
         redirect(this.originalURL);
72 72
     }
73 73
 }

+ 5
- 3
modules/config/BoshAddressChoice.js ファイルの表示

@@ -1,3 +1,5 @@
1
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
+
1 3
 var JSSHA = require('jssha');
2 4
 
3 5
 module.exports = {
@@ -22,7 +24,7 @@ module.exports = {
22 24
         var attemptFirstAddress;
23 25
 
24 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 28
             ' (idx=' + idx + ')');
27 29
 
28 30
         if (config.boshAttemptFirstList &&
@@ -34,10 +36,10 @@ module.exports = {
34 36
 
35 37
             if (attemptFirstAddress != config.bosh) {
36 38
                 config.boshAttemptFirst = attemptFirstAddress;
37
-                console.log('Setting config.boshAttemptFirst=' +
39
+                logger.log('Setting config.boshAttemptFirst=' +
38 40
                     attemptFirstAddress + ' (idx=' + idx + ')');
39 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,4 +1,5 @@
1 1
 /* global $, config, interfaceConfig */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2 3
 
3 4
 var configUtil = require('./Util');
4 5
 
@@ -16,7 +17,7 @@ var HttpConfig = {
16 17
      * @param complete
17 18
      */
18 19
     obtainConfig: function (endpoint, roomName, complete) {
19
-        console.info(
20
+        logger.info(
20 21
             "Send config request to " + endpoint + " for room: " + roomName);
21 22
 
22 23
 
@@ -28,7 +29,7 @@ var HttpConfig = {
28 29
                 data: JSON.stringify({"roomName": roomName}),
29 30
                 dataType: 'json',
30 31
                 error: function(jqXHR, textStatus, errorThrown) {
31
-                    console.error("Get config error: ", jqXHR, errorThrown);
32
+                    logger.error("Get config error: ", jqXHR, errorThrown);
32 33
                     var error = "Get config response status: " + textStatus;
33 34
                     complete(false, error);
34 35
                 },
@@ -39,7 +40,7 @@ var HttpConfig = {
39 40
                         complete(true);
40 41
                         return;
41 42
                     } catch (exception) {
42
-                        console.error("Parse config error: ", exception);
43
+                        logger.error("Parse config error: ", exception);
43 44
                         complete(false, exception);
44 45
                     }
45 46
                 }

+ 11
- 4
modules/config/URLProcessor.js ファイルの表示

@@ -1,4 +1,6 @@
1
-/* global config, interfaceConfig, getConfigParamsFromUrl */
1
+/* global config, interfaceConfig, loggingConfig, getConfigParamsFromUrl */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2 4
 var configUtils = require('./Util');
3 5
 var params = {};
4 6
 
@@ -25,11 +27,12 @@ var URLProcessor = {
25 27
         // }
26 28
         var configJSON = {
27 29
             config: {},
28
-            interfaceConfig: {}
30
+            interfaceConfig: {},
31
+            loggingConfig: {}
29 32
         };
30 33
         for (var key in params) {
31 34
             if (typeof key !== "string") {
32
-                console.warn("Invalid config key: ", key);
35
+                logger.warn("Invalid config key: ", key);
33 36
                 continue;
34 37
             }
35 38
             var confObj = null, confKey;
@@ -45,6 +48,9 @@ var URLProcessor = {
45 48
             } else if (key.indexOf("interfaceConfig.") === 0) {
46 49
                 confObj = configJSON.interfaceConfig;
47 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 56
             if (!confObj)
@@ -52,7 +58,8 @@ var URLProcessor = {
52 58
 
53 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,3 +1,5 @@
1
+const logger = require("jitsi-meet-logger").getLogger(__filename);
2
+
1 3
 var ConfigUtil = {
2 4
     /**
3 5
      * Method overrides JSON properties in <tt>config</tt> and
@@ -5,6 +7,8 @@ var ConfigUtil = {
5 7
      * @param config the config object for which we'll be overriding properties
6 8
      * @param interfaceConfig the interfaceConfig object for which we'll be
7 9
      *                        overriding properties.
10
+     * @param loggingConfig the logging config object for which we'll be
11
+     *        overriding properties.
8 12
      * @param newConfig object containing configuration properties. Destination
9 13
      *        object is selected based on root property name:
10 14
      *        {
@@ -12,11 +16,15 @@ var ConfigUtil = {
12 16
      *             // config.js properties to be
13 17
      *          },
14 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 28
         var configRoot, key, value, confObj;
21 29
         for (configRoot in newConfig) {
22 30
             confObj = null;
@@ -24,6 +32,8 @@ var ConfigUtil = {
24 32
                 confObj = config;
25 33
             } else if (configRoot == "interfaceConfig") {
26 34
                 confObj = interfaceConfig;
35
+            } else if (configRoot == "loggingConfig") {
36
+                confObj = loggingConfig;
27 37
             } else {
28 38
                 continue;
29 39
             }
@@ -31,10 +41,10 @@ var ConfigUtil = {
31 41
             for (key in newConfig[configRoot]) {
32 42
                 value = newConfig[configRoot][key];
33 43
                 if (confObj[key] && typeof confObj[key] !== typeof value) {
34
-                    console.log("Overriding a " + configRoot +
44
+                    logger.log("Overriding a " + configRoot +
35 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 48
                 confObj[key] = value;
39 49
             }
40 50
         }

+ 3
- 1
modules/settings/Settings.js ファイルの表示

@@ -1,4 +1,6 @@
1 1
 /* global JitsiMeetJS */
2
+const logger = require("jitsi-meet-logger").getLogger(__filename);
3
+
2 4
 import UIUtil from '../UI/util/UIUtil';
3 5
 import jitsiLocalStorage from '../util/JitsiLocalStorage';
4 6
 
@@ -37,7 +39,7 @@ if (audioOutputDeviceId !==
37 39
     JitsiMeetJS.mediaDevices.getAudioOutputDevice()) {
38 40
     JitsiMeetJS.mediaDevices.setAudioOutputDevice(audioOutputDeviceId)
39 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 43
                 'storage. Default audio output device will be used' +
42 44
                 'instead.', ex);
43 45
         });

+ 66
- 0
modules/util/JitsiMeetLogStorage.js ファイルの表示

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

+ 1
- 0
package.json ファイルの表示

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

読み込み中…
キャンセル
保存