Merge pull request #1158 from jitsi/log_collector

Log collector
This commit is contained in:
hristoterezov 2016-11-30 13:07:18 -06:00 committed by GitHub
commit 8745efb81f
33 changed files with 354 additions and 117 deletions

108
app.js
View File

@ -1,5 +1,6 @@
/* global $, config, getRoomName */ /* global $, config, getRoomName, loggingConfig, JitsiMeetJS */
/* application specific logic */ /* application specific logic */
const logger = require("jitsi-meet-logger").getLogger(__filename);
import "babel-polyfill"; import "babel-polyfill";
import "jquery"; import "jquery";
@ -18,6 +19,10 @@ import 'aui-experimental-css';
window.toastr = require("toastr"); window.toastr = require("toastr");
const Logger = require("jitsi-meet-logger");
const LogCollector = Logger.LogCollector;
import JitsiMeetLogStorage from "./modules/util/JitsiMeetLogStorage";
import URLProcessor from "./modules/config/URLProcessor"; import URLProcessor from "./modules/config/URLProcessor";
import RoomnameGenerator from './modules/util/RoomnameGenerator'; import RoomnameGenerator from './modules/util/RoomnameGenerator';
@ -31,6 +36,8 @@ import UIEvents from './service/UI/UIEvents';
import getTokenData from "./modules/tokendata/TokenData"; import getTokenData from "./modules/tokendata/TokenData";
import translation from "./modules/translation/translation"; import translation from "./modules/translation/translation";
const ConferenceEvents = JitsiMeetJS.events.conference;
/** /**
* Tries to push history state with the following parameters: * Tries to push history state with the following parameters:
* 'VideoChat', `Room: ${roomName}`, URL. If fail, prints the error and returns * 'VideoChat', `Room: ${roomName}`, URL. If fail, prints the error and returns
@ -42,7 +49,7 @@ function pushHistoryState(roomName, URL) {
'VideoChat', `Room: ${roomName}`, URL 'VideoChat', `Room: ${roomName}`, URL
); );
} catch (e) { } catch (e) {
console.warn("Push history state failed with parameters:", logger.warn("Push history state failed with parameters:",
'VideoChat', `Room: ${roomName}`, URL, e); 'VideoChat', `Room: ${roomName}`, URL, e);
return e; return e;
} }
@ -78,6 +85,36 @@ function buildRoomName () {
return roomName; return roomName;
} }
/**
* Adjusts the logging levels.
* @private
*/
function configureLoggingLevels () {
// NOTE The library Logger is separated from the app loggers, so the levels
// have to be set in two places
// Set default logging level
const defaultLogLevel
= loggingConfig.defaultLogLevel || JitsiMeetJS.logLevels.TRACE;
Logger.setLogLevel(defaultLogLevel);
JitsiMeetJS.setLogLevel(defaultLogLevel);
// NOTE console was used on purpose here to go around the logging
// and always print the default logging level to the console
console.info("Default logging level set to: " + defaultLogLevel);
// Set log level for each logger
if (loggingConfig) {
Object.keys(loggingConfig).forEach(function(loggerName) {
if ('defaultLogLevel' !== loggerName) {
const level = loggingConfig[loggerName];
Logger.setLogLevelById(level, loggerName);
JitsiMeetJS.setLogLevelById(level, loggerName);
}
});
}
}
const APP = { const APP = {
// Used by do_external_connect.js if we receive the attach data after // Used by do_external_connect.js if we receive the attach data after
// connect was already executed. status property can be "initialized", // connect was already executed. status property can be "initialized",
@ -97,6 +134,16 @@ const APP = {
settings, settings,
conference, conference,
translation, translation,
/**
* The log collector which captures JS console logs for this app.
* @type {LogCollector}
*/
logCollector: null,
/**
* Indicates if the log collector has been started (it will not be started
* if the welcome page is displayed).
*/
logCollectorStarted : false,
/** /**
* After the APP has been initialized provides utility methods for dealing * After the APP has been initialized provides utility methods for dealing
* with the conference room URL(address). * with the conference room URL(address).
@ -106,10 +153,24 @@ const APP = {
connection: null, connection: null,
API, API,
init () { init () {
this.initLogging();
this.keyboardshortcut = this.keyboardshortcut =
require("./modules/keyboardshortcut/keyboardshortcut"); require("./modules/keyboardshortcut/keyboardshortcut");
this.configFetch = require("./modules/config/HttpConfigFetch"); this.configFetch = require("./modules/config/HttpConfigFetch");
this.tokenData = getTokenData(); this.tokenData = getTokenData();
},
initLogging () {
// Adjust logging level
configureLoggingLevels();
// Create the LogCollector and register it as the global log transport.
// It is done early to capture as much logs as possible. Captured logs
// will be cached, before the JitsiMeetLogStorage gets ready (statistics
// module is initialized).
if (!this.logCollector && !loggingConfig.disableLogCollector) {
this.logCollector = new LogCollector(new JitsiMeetLogStorage());
Logger.addGlobalTransport(this.logCollector);
JitsiMeetJS.addGlobalLogTransport(this.logCollector);
}
} }
}; };
@ -131,9 +192,39 @@ function init() {
APP.ConferenceUrl = new ConferenceUrl(window.location); APP.ConferenceUrl = new ConferenceUrl(window.location);
// Clean up the URL displayed by the browser // Clean up the URL displayed by the browser
replaceHistoryState(APP.ConferenceUrl.getInviteUrl()); replaceHistoryState(APP.ConferenceUrl.getInviteUrl());
var isUIReady = APP.UI.start(); const isUIReady = APP.UI.start();
if (isUIReady) { if (isUIReady) {
APP.conference.init({roomName: buildRoomName()}).then(function () { APP.conference.init({roomName: buildRoomName()}).then(function () {
if (APP.logCollector) {
// Start the LogCollector's periodic "store logs" task only if
// we're in the conference and not on the welcome page. This is
// determined by the value of "isUIReady" const above.
APP.logCollector.start();
APP.logCollectorStarted = true;
// Make an attempt to flush in case a lot of logs have been
// cached, before the collector was started.
APP.logCollector.flush();
// This event listener will flush the logs, before
// the statistics module (CallStats) is stopped.
//
// NOTE The LogCollector is not stopped, because this event can
// be triggered multiple times during single conference
// (whenever statistics module is stopped). That includes
// the case when Jicofo terminates the single person left in the
// room. It will then restart the media session when someone
// eventually join the room which will start the stats again.
APP.conference.addConferenceListener(
ConferenceEvents.BEFORE_STATISTICS_DISPOSED,
() => {
if (APP.logCollector) {
APP.logCollector.flush();
}
}
);
}
APP.UI.initConference(); APP.UI.initConference();
APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) { APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) {
@ -145,7 +236,7 @@ function init() {
}).catch(function (err) { }).catch(function (err) {
APP.UI.hideRingOverLay(); APP.UI.hideRingOverLay();
APP.API.notifyConferenceLeft(APP.conference.roomName); APP.API.notifyConferenceLeft(APP.conference.roomName);
console.error(err); logger.error(err);
}); });
} }
} }
@ -169,7 +260,7 @@ function obtainConfigAndInit() {
if (success) { if (success) {
var now = APP.connectionTimes["configuration.fetched"] = var now = APP.connectionTimes["configuration.fetched"] =
window.performance.now(); window.performance.now();
console.log("(TIME) configuration fetched:\t", now); logger.log("(TIME) configuration fetched:\t", now);
init(); init();
} else { } else {
// Show obtain config error, // Show obtain config error,
@ -189,7 +280,7 @@ function obtainConfigAndInit() {
$(document).ready(function () { $(document).ready(function () {
var now = APP.connectionTimes["document.ready"] = window.performance.now(); var now = APP.connectionTimes["document.ready"] = window.performance.now();
console.log("(TIME) document ready:\t", now); logger.log("(TIME) document ready:\t", now);
URLProcessor.setConfigParametersFromUrl(); URLProcessor.setConfigParametersFromUrl();
@ -211,6 +302,11 @@ $(document).ready(function () {
}); });
$(window).bind('beforeunload', function () { $(window).bind('beforeunload', function () {
// Stop the LogCollector
if (APP.logCollectorStarted) {
APP.logCollector.stop();
APP.logCollectorStarted = false;
}
APP.API.dispose(); APP.API.dispose();
}); });

View File

@ -1,4 +1,6 @@
/* global $, APP, JitsiMeetJS, config, interfaceConfig */ /* global $, APP, JitsiMeetJS, config, interfaceConfig */
const logger = require("jitsi-meet-logger").getLogger(__filename);
import {openConnection} from './connection'; import {openConnection} from './connection';
import Invite from './modules/UI/invite/Invite'; import Invite from './modules/UI/invite/Invite';
import ContactList from './modules/UI/side_pannels/contactlist/ContactList'; import ContactList from './modules/UI/side_pannels/contactlist/ContactList';
@ -166,7 +168,7 @@ function muteLocalMedia(localMedia, muted, localMediaTypeString) {
const method = muted ? 'mute' : 'unmute'; const method = muted ? 'mute' : 'unmute';
localMedia[method]().catch(reason => { localMedia[method]().catch(reason => {
console.warn(`${localMediaTypeString} ${method} was rejected:`, reason); logger.warn(`${localMediaTypeString} ${method} was rejected:`, reason);
}); });
} }
@ -254,7 +256,7 @@ function createLocalTracks (options, checkForPermissionPrompt) {
}); });
return tracks; return tracks;
}).catch(function (err) { }).catch(function (err) {
console.error( logger.error(
'failed to create local tracks', options.devices, err); 'failed to create local tracks', options.devices, err);
return Promise.reject(err); return Promise.reject(err);
}); });
@ -311,7 +313,7 @@ class ConferenceConnector {
this._reject(err); this._reject(err);
} }
_onConferenceFailed(err, ...params) { _onConferenceFailed(err, ...params) {
console.error('CONFERENCE FAILED:', err, ...params); logger.error('CONFERENCE FAILED:', err, ...params);
APP.UI.hideRingOverLay(); APP.UI.hideRingOverLay();
switch (err) { switch (err) {
// room is locked by the password // room is locked by the password
@ -400,7 +402,7 @@ class ConferenceConnector {
} }
} }
_onConferenceError(err, ...params) { _onConferenceError(err, ...params) {
console.error('CONFERENCE Error:', err, params); logger.error('CONFERENCE Error:', err, params);
switch (err) { switch (err) {
case ConferenceErrors.CHAT_ERROR: case ConferenceErrors.CHAT_ERROR:
{ {
@ -409,7 +411,7 @@ class ConferenceConnector {
} }
break; break;
default: default:
console.error("Unknown error."); logger.error("Unknown error.", err);
} }
} }
_unsubscribe() { _unsubscribe() {
@ -464,8 +466,6 @@ export default {
*/ */
init(options) { init(options) {
this.roomName = options.roomName; this.roomName = options.roomName;
JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.TRACE);
// attaches global error handler, if there is already one, respect it // attaches global error handler, if there is already one, respect it
if(JitsiMeetJS.getGlobalOnErrorHandler){ if(JitsiMeetJS.getGlobalOnErrorHandler){
var oldOnErrorHandler = window.onerror; var oldOnErrorHandler = window.onerror;
@ -495,7 +495,7 @@ export default {
analytics.init(); analytics.init();
return createInitialLocalTracksAndConnect(options.roomName); return createInitialLocalTracksAndConnect(options.roomName);
}).then(([tracks, con]) => { }).then(([tracks, con]) => {
console.log('initialized with %s local tracks', tracks.length); logger.log('initialized with %s local tracks', tracks.length);
APP.connection = connection = con; APP.connection = connection = con;
this._bindConnectionFailedHandler(con); this._bindConnectionFailedHandler(con);
this._createRoom(tracks); this._createRoom(tracks);
@ -549,7 +549,7 @@ export default {
// - item-not-found // - item-not-found
// - connection dropped(closed by Strophe unexpectedly // - connection dropped(closed by Strophe unexpectedly
// possible due too many transport errors) // possible due too many transport errors)
console.error("XMPP connection error: " + errMsg); logger.error("XMPP connection error: " + errMsg);
APP.UI.showPageReloadOverlay(); APP.UI.showPageReloadOverlay();
connection.removeEventListener( connection.removeEventListener(
ConnectionEvents.CONNECTION_FAILED, handler); ConnectionEvents.CONNECTION_FAILED, handler);
@ -879,7 +879,7 @@ export default {
} else if (track.isVideoTrack()) { } else if (track.isVideoTrack()) {
return this.useVideoStream(track); return this.useVideoStream(track);
} else { } else {
console.error( logger.error(
"Ignored not an audio nor a video track: ", track); "Ignored not an audio nor a video track: ", track);
return Promise.resolve(); return Promise.resolve();
} }
@ -971,11 +971,11 @@ export default {
videoSwitchInProgress: false, videoSwitchInProgress: false,
toggleScreenSharing (shareScreen = !this.isSharingScreen) { toggleScreenSharing (shareScreen = !this.isSharingScreen) {
if (this.videoSwitchInProgress) { if (this.videoSwitchInProgress) {
console.warn("Switch in progress."); logger.warn("Switch in progress.");
return; return;
} }
if (!this.isDesktopSharingEnabled) { if (!this.isDesktopSharingEnabled) {
console.warn("Cannot toggle screen sharing: not supported."); logger.warn("Cannot toggle screen sharing: not supported.");
return; return;
} }
@ -1029,7 +1029,7 @@ export default {
this.videoSwitchInProgress = false; this.videoSwitchInProgress = false;
JitsiMeetJS.analytics.sendEvent( JitsiMeetJS.analytics.sendEvent(
'conference.sharingDesktop.start'); 'conference.sharingDesktop.start');
console.log('sharing local desktop'); logger.log('sharing local desktop');
}).catch((err) => { }).catch((err) => {
// close external installation dialog to show the error. // close external installation dialog to show the error.
if(externalInstallation) if(externalInstallation)
@ -1041,7 +1041,7 @@ export default {
return; return;
} }
console.error('failed to share local desktop', err); logger.error('failed to share local desktop', err);
if (err.name === TrackErrors.FIREFOX_EXTENSION_NEEDED) { if (err.name === TrackErrors.FIREFOX_EXTENSION_NEEDED) {
APP.UI.showExtensionRequiredDialog( APP.UI.showExtensionRequiredDialog(
@ -1078,11 +1078,11 @@ export default {
this.videoSwitchInProgress = false; this.videoSwitchInProgress = false;
JitsiMeetJS.analytics.sendEvent( JitsiMeetJS.analytics.sendEvent(
'conference.sharingDesktop.stop'); 'conference.sharingDesktop.stop');
console.log('sharing local video'); logger.log('sharing local video');
}).catch((err) => { }).catch((err) => {
this.useVideoStream(null); this.useVideoStream(null);
this.videoSwitchInProgress = false; this.videoSwitchInProgress = false;
console.error('failed to share local video', err); logger.error('failed to share local video', err);
}); });
} }
}, },
@ -1108,7 +1108,7 @@ export default {
if (user.isHidden()) if (user.isHidden())
return; return;
console.log('USER %s connnected', id, user); logger.log('USER %s connnected', id, user);
APP.API.notifyUserJoined(id); APP.API.notifyUserJoined(id);
APP.UI.addUser(user); APP.UI.addUser(user);
@ -1116,7 +1116,7 @@ export default {
APP.UI.updateUserRole(user); APP.UI.updateUserRole(user);
}); });
room.on(ConferenceEvents.USER_LEFT, (id, user) => { room.on(ConferenceEvents.USER_LEFT, (id, user) => {
console.log('USER %s LEFT', id, user); logger.log('USER %s LEFT', id, user);
APP.API.notifyUserLeft(id); APP.API.notifyUserLeft(id);
APP.UI.removeUser(id, user.getDisplayName()); APP.UI.removeUser(id, user.getDisplayName());
APP.UI.onSharedVideoStop(id); APP.UI.onSharedVideoStop(id);
@ -1125,7 +1125,7 @@ export default {
room.on(ConferenceEvents.USER_ROLE_CHANGED, (id, role) => { room.on(ConferenceEvents.USER_ROLE_CHANGED, (id, role) => {
if (this.isLocalId(id)) { if (this.isLocalId(id)) {
console.info(`My role changed, new role: ${role}`); logger.info(`My role changed, new role: ${role}`);
if (this.isModerator !== room.isModerator()) { if (this.isModerator !== room.isModerator()) {
this.isModerator = room.isModerator(); this.isModerator = room.isModerator();
APP.UI.updateLocalRole(room.isModerator()); APP.UI.updateLocalRole(room.isModerator());
@ -1183,7 +1183,7 @@ export default {
{ {
this.audioLevelsMap[id] = lvl; this.audioLevelsMap[id] = lvl;
if(config.debugAudioLevels) if(config.debugAudioLevels)
console.log("AudioLevel:" + id + "/" + lvl); logger.log("AudioLevel:" + id + "/" + lvl);
} }
APP.UI.setAudioLevel(id, lvl); APP.UI.setAudioLevel(id, lvl);
@ -1264,7 +1264,7 @@ export default {
}); });
room.on(ConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => { room.on(ConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => {
console.log("Received recorder status change: ", status, error); logger.log("Received recorder status change: ", status, error);
APP.UI.updateRecordingState(status); APP.UI.updateRecordingState(status);
}); });
@ -1500,7 +1500,7 @@ export default {
}) })
.then(([stream]) => { .then(([stream]) => {
this.useVideoStream(stream); this.useVideoStream(stream);
console.log('switched local video device'); logger.log('switched local video device');
APP.settings.setCameraDeviceId(cameraDeviceId, true); APP.settings.setCameraDeviceId(cameraDeviceId, true);
}) })
.catch((err) => { .catch((err) => {
@ -1522,7 +1522,7 @@ export default {
}) })
.then(([stream]) => { .then(([stream]) => {
this.useAudioStream(stream); this.useAudioStream(stream);
console.log('switched local audio device'); logger.log('switched local audio device');
APP.settings.setMicDeviceId(micDeviceId, true); APP.settings.setMicDeviceId(micDeviceId, true);
}) })
.catch((err) => { .catch((err) => {
@ -1538,9 +1538,9 @@ export default {
JitsiMeetJS.analytics.sendEvent( JitsiMeetJS.analytics.sendEvent(
'settings.changeDevice.audioOut'); 'settings.changeDevice.audioOut');
APP.settings.setAudioOutputDeviceId(audioOutputDeviceId) APP.settings.setAudioOutputDeviceId(audioOutputDeviceId)
.then(() => console.log('changed audio output device')) .then(() => logger.log('changed audio output device'))
.catch((err) => { .catch((err) => {
console.warn('Failed to change audio output device. ' + logger.warn('Failed to change audio output device. ' +
'Default or previously set audio output device ' + 'Default or previously set audio output device ' +
'will be used instead.', err); 'will be used instead.', err);
APP.UI.setSelectedAudioOutputFromSettings(); APP.UI.setSelectedAudioOutputFromSettings();
@ -1746,6 +1746,15 @@ export default {
room.sendApplicationLog(JSON.stringify({name, value})); room.sendApplicationLog(JSON.stringify({name, value}));
} }
}, },
/**
* Methods logs an application event given in the JSON format.
* @param {string} logJSON an event to be logged in JSON format
*/
logJSON(logJSON) {
if (room) {
room.sendApplicationLog(logJSON);
}
},
/** /**
* Disconnect from the conference and optionally request user feedback. * Disconnect from the conference and optionally request user feedback.
* @param {boolean} [requestFeedback=false] if user feedback should be * @param {boolean} [requestFeedback=false] if user feedback should be

View File

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

View File

@ -14,6 +14,7 @@
"utils.js", "utils.js",
"do_external_connect.js", "do_external_connect.js",
"interface_config.js", "interface_config.js",
"logging_config.js",
"lib-jitsi-meet.min.js", "lib-jitsi-meet.min.js",
"app.bundle.min.js", "app.bundle.min.js",
"all.css" "all.css"
@ -43,6 +44,7 @@
<!--#include virtual="connection_optimization/connection_optimization.html" --> <!--#include virtual="connection_optimization/connection_optimization.html" -->
<script src="connection_optimization/do_external_connect.js?v=1"></script> <script src="connection_optimization/do_external_connect.js?v=1"></script>
<script><!--#include virtual="/interface_config.js" --></script> <script><!--#include virtual="/interface_config.js" --></script>
<script><!--#include virtual="/logging_config.js" --></script>
<script src="libs/lib-jitsi-meet.min.js?v=139"></script> <script src="libs/lib-jitsi-meet.min.js?v=139"></script>
<script src="libs/app.bundle.min.js?v=139"></script> <script src="libs/app.bundle.min.js?v=139"></script>
<!--#include virtual="title.html" --> <!--#include virtual="title.html" -->

10
logging_config.js Normal file
View File

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

View File

@ -1,4 +1,6 @@
/* global APP, getConfigParamsFromUrl */ /* global APP, getConfigParamsFromUrl */
const logger = require("jitsi-meet-logger").getLogger(__filename);
/** /**
* Implements API class that communicates with external api class * Implements API class that communicates with external api class
* and provides interface to access Jitsi Meet features by external * and provides interface to access Jitsi Meet features by external
@ -131,13 +133,13 @@ function onSystemMessage(message) {
switch (message.type) { switch (message.type) {
case "eventStatus": case "eventStatus":
if(!message.name || !message.value) { if(!message.name || !message.value) {
console.warn("Unknown system message format", message); logger.warn("Unknown system message format", message);
break; break;
} }
events[message.name] = message.value; events[message.name] = message.value;
break; break;
default: default:
console.warn("Unknown system message type", message); logger.warn("Unknown system message type", message);
} }
} }

View File

@ -1,3 +1,5 @@
const logger = require("jitsi-meet-logger").getLogger(__filename);
/** /**
* Implements API class that embeds Jitsi Meet in external applications. * Implements API class that embeds Jitsi Meet in external applications.
*/ */
@ -72,7 +74,7 @@ function sendMessage(postis, object) {
*/ */
function changeEventStatus(postis, event, status) { function changeEventStatus(postis, event, status) {
if(!(event in events)) { if(!(event in events)) {
console.error("Not supported event name."); logger.error("Not supported event name.");
return; return;
} }
sendMessage(postis, { sendMessage(postis, {
@ -174,7 +176,7 @@ function JitsiMeetExternalAPI(domain, room_name, width, height, parentNode,
*/ */
JitsiMeetExternalAPI.prototype.executeCommand = function(name, argumentsList) { JitsiMeetExternalAPI.prototype.executeCommand = function(name, argumentsList) {
if(!(name in commands)) { if(!(name in commands)) {
console.error("Not supported command name."); logger.error("Not supported command name.");
return; return;
} }
var argumentsArray = argumentsList; var argumentsArray = argumentsList;
@ -306,7 +308,7 @@ JitsiMeetExternalAPI.prototype.addEventListeners = function(object) {
*/ */
JitsiMeetExternalAPI.prototype.addEventListener = function(event, listener) { JitsiMeetExternalAPI.prototype.addEventListener = function(event, listener) {
if(!(event in events)) { if(!(event in events)) {
console.error("Not supported event name."); logger.error("Not supported event name.");
return; return;
} }
// We cannot remove listeners from postis that's why we are handling the // We cannot remove listeners from postis that's why we are handling the
@ -328,7 +330,7 @@ JitsiMeetExternalAPI.prototype.addEventListener = function(event, listener) {
JitsiMeetExternalAPI.prototype.removeEventListener = function(event) { JitsiMeetExternalAPI.prototype.removeEventListener = function(event) {
if(!(event in this.eventHandlers)) if(!(event in this.eventHandlers))
{ {
console.error("The event " + event + " is not registered."); logger.error("The event " + event + " is not registered.");
return; return;
} }
delete this.eventHandlers[event]; delete this.eventHandlers[event];

View File

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

View File

@ -1,4 +1,6 @@
/* global APP, JitsiMeetJS, $, config, interfaceConfig, toastr */ /* global APP, JitsiMeetJS, $, config, interfaceConfig, toastr */
const logger = require("jitsi-meet-logger").getLogger(__filename);
var UI = {}; var UI = {};
import Chat from "./side_pannels/chat/Chat"; import Chat from "./side_pannels/chat/Chat";
@ -503,7 +505,7 @@ UI.addLocalStream = function (track) {
VideoLayout.changeLocalVideo(track); VideoLayout.changeLocalVideo(track);
break; break;
default: default:
console.error("Unknown stream type: " + track.getType()); logger.error("Unknown stream type: " + track.getType());
break; break;
} }
}; };
@ -541,7 +543,7 @@ UI.initEtherpad = function (name) {
if (etherpadManager || !config.etherpad_base || !name) { if (etherpadManager || !config.etherpad_base || !name) {
return; return;
} }
console.log('Etherpad is enabled'); logger.log('Etherpad is enabled');
etherpadManager etherpadManager
= new EtherpadManager(config.etherpad_base, name, eventEmitter); = new EtherpadManager(config.etherpad_base, name, eventEmitter);
Toolbar.showEtherpadButton(); Toolbar.showEtherpadButton();
@ -739,7 +741,7 @@ UI.connectionIndicatorShowMore = function(id) {
// FIXME check if someone user this // FIXME check if someone user this
UI.showLoginPopup = function(callback) { UI.showLoginPopup = function(callback) {
console.log('password is required'); logger.log('password is required');
let message = ( let message = (
`<input name="username" type="text" `<input name="username" type="text"

View File

@ -1,4 +1,5 @@
/* global APP, config, JitsiMeetJS, Promise */ /* global APP, config, JitsiMeetJS, Promise */
const logger = require("jitsi-meet-logger").getLogger(__filename);
import LoginDialog from './LoginDialog'; import LoginDialog from './LoginDialog';
import UIUtil from '../util/UIUtil'; import UIUtil from '../util/UIUtil';
@ -74,13 +75,13 @@ function redirectToTokenAuthService(roomName) {
function initJWTTokenListener(room) { function initJWTTokenListener(room) {
var listener = function (event) { var listener = function (event) {
if (externalAuthWindow !== event.source) { if (externalAuthWindow !== event.source) {
console.warn("Ignored message not coming " + logger.warn("Ignored message not coming " +
"from external authnetication window"); "from external authnetication window");
return; return;
} }
if (event.data && event.data.jwtToken) { if (event.data && event.data.jwtToken) {
config.token = event.data.jwtToken; config.token = event.data.jwtToken;
console.info("Received JWT token:", config.token); logger.info("Received JWT token:", config.token);
var roomName = room.getName(); var roomName = room.getName();
openConnection({retry: false, roomName: roomName }) openConnection({retry: false, roomName: roomName })
.then(function (connection) { .then(function (connection) {
@ -97,10 +98,10 @@ function initJWTTokenListener(room) {
// to upgrade user's role // to upgrade user's role
room.room.moderator.authenticate() room.room.moderator.authenticate()
.then(function () { .then(function () {
console.info("User role upgrade done !"); logger.info("User role upgrade done !");
unregister(); unregister();
}).catch(function (err, errCode) { }).catch(function (err, errCode) {
console.error( logger.error(
"Authentication failed: ", err, errCode); "Authentication failed: ", err, errCode);
unregister(); unregister();
} }
@ -108,13 +109,13 @@ function initJWTTokenListener(room) {
}).catch(function (error, code) { }).catch(function (error, code) {
unregister(); unregister();
connection.disconnect(); connection.disconnect();
console.error( logger.error(
'Authentication failed on the new connection', 'Authentication failed on the new connection',
error, code); error, code);
}); });
}, function (err) { }, function (err) {
unregister(); unregister();
console.error("Failed to open new connection", err); logger.error("Failed to open new connection", err);
}); });
} }
}; };
@ -161,7 +162,7 @@ function doXmppAuth (room, lockPassword) {
}).catch(function (error, code) { }).catch(function (error, code) {
connection.disconnect(); connection.disconnect();
console.error('Auth on the fly failed', error); logger.error('Auth on the fly failed', error);
loginDialog.displayError( loginDialog.displayError(
'connection.GET_SESSION_ID_ERROR', {code: code}); 'connection.GET_SESSION_ID_ERROR', {code: code});

View File

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

View File

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

View File

@ -1,4 +1,5 @@
/* global $, APP, JitsiMeetJS */ /* global $, APP, JitsiMeetJS */
const logger = require("jitsi-meet-logger").getLogger(__filename);
/** /**
* Substate for password * Substate for password
@ -312,7 +313,7 @@ export default class InviteDialogView {
this.blur(); this.blur();
} }
catch (err) { catch (err) {
console.error('error when copy the text'); logger.error('error when copy the text');
} }
} }
}); });

View File

@ -1,4 +1,6 @@
/* global APP, JitsiMeetJS */ /* global APP, JitsiMeetJS */
const logger = require("jitsi-meet-logger").getLogger(__filename);
import RequirePasswordDialog from './RequirePasswordDialog'; import RequirePasswordDialog from './RequirePasswordDialog';
/** /**
@ -6,7 +8,7 @@ import RequirePasswordDialog from './RequirePasswordDialog';
* because server doesn't support that. * because server doesn't support that.
*/ */
function notifyPasswordNotSupported () { function notifyPasswordNotSupported () {
console.warn('room passwords not supported'); logger.warn('room passwords not supported');
APP.UI.messageHandler.showError( APP.UI.messageHandler.showError(
"dialog.warning", "dialog.passwordNotSupported"); "dialog.warning", "dialog.passwordNotSupported");
} }
@ -16,7 +18,7 @@ function notifyPasswordNotSupported () {
* @param {Error} err error * @param {Error} err error
*/ */
function notifyPasswordFailed(err) { function notifyPasswordFailed(err) {
console.warn('setting password failed', err); logger.warn('setting password failed', err);
APP.UI.messageHandler.showError( APP.UI.messageHandler.showError(
"dialog.lockTitle", "dialog.lockMessage"); "dialog.lockTitle", "dialog.lockMessage");
} }
@ -64,7 +66,7 @@ export default function createRoomLocker (room) {
if (!password) if (!password)
lockedElsewhere = false; lockedElsewhere = false;
}).catch(function (err) { }).catch(function (err) {
console.error(err); logger.error(err);
if (err === ConferenceErrors.PASSWORD_NOT_SUPPORTED) { if (err === ConferenceErrors.PASSWORD_NOT_SUPPORTED) {
notifyPasswordNotSupported(); notifyPasswordNotSupported();
} else { } else {
@ -113,7 +115,7 @@ export default function createRoomLocker (room) {
// pass stays between attempts // pass stays between attempts
password = null; password = null;
if (reason !== APP.UI.messageHandler.CANCEL) if (reason !== APP.UI.messageHandler.CANCEL)
console.error(reason); logger.error(reason);
} }
); );
}, },

View File

@ -14,6 +14,8 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
const logger = require("jitsi-meet-logger").getLogger(__filename);
import UIEvents from "../../../service/UI/UIEvents"; import UIEvents from "../../../service/UI/UIEvents";
import UIUtil from '../util/UIUtil'; import UIUtil from '../util/UIUtil';
import VideoLayout from '../videolayout/VideoLayout'; import VideoLayout from '../videolayout/VideoLayout';
@ -327,7 +329,7 @@ var Recording = {
}).catch( }).catch(
reason => { reason => {
if (reason !== APP.UI.messageHandler.CANCEL) if (reason !== APP.UI.messageHandler.CANCEL)
console.error(reason); logger.error(reason);
else else
JitsiMeetJS.analytics.sendEvent( JitsiMeetJS.analytics.sendEvent(
'recording.canceled'); 'recording.canceled');
@ -350,7 +352,7 @@ var Recording = {
}).catch( }).catch(
reason => { reason => {
if (reason !== APP.UI.messageHandler.CANCEL) if (reason !== APP.UI.messageHandler.CANCEL)
console.error(reason); logger.error(reason);
else else
JitsiMeetJS.analytics.sendEvent( JitsiMeetJS.analytics.sendEvent(
'recording.canceled'); 'recording.canceled');

View File

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

View File

@ -1,5 +1,6 @@
/* global $, APP, YT, onPlayerReady, onPlayerStateChange, onPlayerError, /* global $, APP, YT, onPlayerReady, onPlayerStateChange, onPlayerError,
JitsiMeetJS */ JitsiMeetJS */
const logger = require("jitsi-meet-logger").getLogger(__filename);
import UIUtil from '../util/UIUtil'; import UIUtil from '../util/UIUtil';
import UIEvents from '../../../service/UI/UIEvents'; import UIEvents from '../../../service/UI/UIEvents';
@ -75,7 +76,7 @@ export default class SharedVideoManager {
JitsiMeetJS.analytics.sendEvent('sharedvideo.started'); JitsiMeetJS.analytics.sendEvent('sharedvideo.started');
}, },
err => { err => {
console.log('SHARED VIDEO CANCELED', err); logger.log('SHARED VIDEO CANCELED', err);
JitsiMeetJS.analytics.sendEvent('sharedvideo.canceled'); JitsiMeetJS.analytics.sendEvent('sharedvideo.canceled');
} }
); );
@ -277,7 +278,7 @@ export default class SharedVideoManager {
}; };
window.onPlayerError = function(event) { window.onPlayerError = function(event) {
console.error("Error in the player:", event.data); logger.error("Error in the player:", event.data);
// store the error player, so we can remove it // store the error player, so we can remove it
self.errorInPlayer = event.target; self.errorInPlayer = event.target;
}; };
@ -313,7 +314,7 @@ export default class SharedVideoManager {
&& player.getVolume() != attributes.volume) { && player.getVolume() != attributes.volume) {
player.setVolume(attributes.volume); player.setVolume(attributes.volume);
console.info("Player change of volume:" + attributes.volume); logger.info("Player change of volume:" + attributes.volume);
this.showSharedVideoMutedPopup(false); this.showSharedVideoMutedPopup(false);
} }
@ -337,7 +338,7 @@ export default class SharedVideoManager {
processTime (player, attributes, forceSeek) processTime (player, attributes, forceSeek)
{ {
if(forceSeek) { if(forceSeek) {
console.info("Player seekTo:", attributes.time); logger.info("Player seekTo:", attributes.time);
player.seekTo(attributes.time); player.seekTo(attributes.time);
return; return;
} }
@ -349,7 +350,7 @@ export default class SharedVideoManager {
// if we drift more than the interval for checking // if we drift more than the interval for checking
// sync, the interval is in milliseconds // sync, the interval is in milliseconds
if(diff > updateInterval/1000) { if(diff > updateInterval/1000) {
console.info("Player seekTo:", attributes.time, logger.info("Player seekTo:", attributes.time,
" current time is:", currentPosition, " diff:", diff); " current time is:", currentPosition, " diff:", diff);
player.seekTo(attributes.time); player.seekTo(attributes.time);
} }
@ -669,7 +670,7 @@ SharedVideoThumb.prototype.videoClick = function () {
* Removes RemoteVideo from the page. * Removes RemoteVideo from the page.
*/ */
SharedVideoThumb.prototype.remove = function () { SharedVideoThumb.prototype.remove = function () {
console.log("Remove shared video thumb", this.id); logger.log("Remove shared video thumb", this.id);
// Make sure that the large video is updated if are removing its // Make sure that the large video is updated if are removing its
// corresponding small video. // corresponding small video.
@ -686,7 +687,7 @@ SharedVideoThumb.prototype.remove = function () {
*/ */
SharedVideoThumb.prototype.setDisplayName = function(displayName) { SharedVideoThumb.prototype.setDisplayName = function(displayName) {
if (!this.container) { if (!this.container) {
console.warn( "Unable to set displayName - " + this.videoSpanId + logger.warn( "Unable to set displayName - " + this.videoSpanId +
" does not exist"); " does not exist");
return; return;
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
/* global $, APP, interfaceConfig */ /* global $, APP, interfaceConfig */
const logger = require("jitsi-meet-logger").getLogger(__filename);
import ConnectionIndicator from './ConnectionIndicator'; import ConnectionIndicator from './ConnectionIndicator';
@ -191,7 +192,7 @@ RemoteVideo.prototype._muteHandler = function () {
} }
}).catch(e => { }).catch(e => {
//currently shouldn't be called //currently shouldn't be called
console.error(e); logger.error(e);
}); });
this.popover.forceHide(); this.popover.forceHide();
@ -343,7 +344,7 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream) {
this.wasVideoPlayed = false; this.wasVideoPlayed = false;
} }
console.info((isVideo ? "Video" : "Audio") + logger.info((isVideo ? "Video" : "Audio") +
" removed " + this.id, select); " removed " + this.id, select);
// when removing only the video element and we are on stage // when removing only the video element and we are on stage
@ -408,7 +409,7 @@ RemoteVideo.prototype.updateConnectionStatusIndicator = function (isActive) {
} }
} }
console.debug(this.id + " thumbnail is connection active ? " + isActive); logger.debug(this.id + " thumbnail is connection active ? " + isActive);
// Update 'mutedWhileDisconnected' flag // Update 'mutedWhileDisconnected' flag
this._figureOutMutedWhileDisconnected(!isActive); this._figureOutMutedWhileDisconnected(!isActive);
@ -427,7 +428,7 @@ RemoteVideo.prototype.updateConnectionStatusIndicator = function (isActive) {
* Removes RemoteVideo from the page. * Removes RemoteVideo from the page.
*/ */
RemoteVideo.prototype.remove = function () { RemoteVideo.prototype.remove = function () {
console.log("Remove thumbnail", this.id); logger.log("Remove thumbnail", this.id);
this.removeConnectionIndicator(); this.removeConnectionIndicator();
// Make sure that the large video is updated if are removing its // Make sure that the large video is updated if are removing its
// corresponding small video. // corresponding small video.
@ -586,7 +587,7 @@ RemoteVideo.prototype.hideConnectionIndicator = function () {
*/ */
RemoteVideo.prototype.setDisplayName = function(displayName) { RemoteVideo.prototype.setDisplayName = function(displayName) {
if (!this.container) { if (!this.container) {
console.warn( "Unable to set displayName - " + this.videoSpanId + logger.warn( "Unable to set displayName - " + this.videoSpanId +
" does not exist"); " does not exist");
return; return;
} }

View File

@ -1,4 +1,6 @@
/* global $, JitsiMeetJS, interfaceConfig */ /* global $, JitsiMeetJS, interfaceConfig */
const logger = require("jitsi-meet-logger").getLogger(__filename);
import Avatar from "../avatar/Avatar"; import Avatar from "../avatar/Avatar";
import UIUtil from "../util/UIUtil"; import UIUtil from "../util/UIUtil";
import UIEvents from "../../../service/UI/UIEvents"; import UIEvents from "../../../service/UI/UIEvents";
@ -497,7 +499,7 @@ SmallVideo.prototype.updateView = function () {
// Init avatar // Init avatar
this.avatarChanged(Avatar.getAvatarUrl(this.id)); this.avatarChanged(Avatar.getAvatarUrl(this.id));
} else { } else {
console.error("Unable to init avatar - no id", this); logger.error("Unable to init avatar - no id", this);
return; return;
} }
} }
@ -555,7 +557,7 @@ SmallVideo.prototype.showDominantSpeakerIndicator = function (show) {
return; return;
if (!this.container) { if (!this.container) {
console.warn( "Unable to set dominant speaker indicator - " logger.warn( "Unable to set dominant speaker indicator - "
+ this.videoSpanId + " does not exist"); + this.videoSpanId + " does not exist");
return; return;
} }
@ -579,7 +581,7 @@ SmallVideo.prototype.showDominantSpeakerIndicator = function (show) {
*/ */
SmallVideo.prototype.showRaisedHandIndicator = function (show) { SmallVideo.prototype.showRaisedHandIndicator = function (show) {
if (!this.container) { if (!this.container) {
console.warn( "Unable to raised hand indication - " logger.warn( "Unable to raised hand indication - "
+ this.videoSpanId + " does not exist"); + this.videoSpanId + " does not exist");
return; return;
} }

View File

@ -1,4 +1,5 @@
/* global config, APP, $, interfaceConfig */ /* global config, APP, $, interfaceConfig */
const logger = require("jitsi-meet-logger").getLogger(__filename);
import FilmStrip from "./FilmStrip"; import FilmStrip from "./FilmStrip";
import UIEvents from "../../../service/UI/UIEvents"; import UIEvents from "../../../service/UI/UIEvents";
@ -261,19 +262,19 @@ var VideoLayout = {
if (lastVisible.length) { if (lastVisible.length) {
let id = getPeerContainerResourceId(lastVisible[0]); let id = getPeerContainerResourceId(lastVisible[0]);
if (remoteVideos[id]) { if (remoteVideos[id]) {
console.info("electLastVisibleVideo: " + id); logger.info("electLastVisibleVideo: " + id);
return id; return id;
} }
// The RemoteVideo was removed (but the DOM elements may still // The RemoteVideo was removed (but the DOM elements may still
// exist). // exist).
} }
console.info("Last visible video no longer exists"); logger.info("Last visible video no longer exists");
thumbs = FilmStrip.getThumbs().remoteThumbs; thumbs = FilmStrip.getThumbs().remoteThumbs;
if (thumbs.length) { if (thumbs.length) {
let id = getPeerContainerResourceId(thumbs[0]); let id = getPeerContainerResourceId(thumbs[0]);
if (remoteVideos[id]) { if (remoteVideos[id]) {
console.info("electLastVisibleVideo: " + id); logger.info("electLastVisibleVideo: " + id);
return id; return id;
} }
// The RemoteVideo was removed (but the DOM elements may // The RemoteVideo was removed (but the DOM elements may
@ -281,10 +282,10 @@ var VideoLayout = {
} }
// Go with local video // Go with local video
console.info("Fallback to local video..."); logger.info("Fallback to local video...");
let id = APP.conference.getMyUserId(); let id = APP.conference.getMyUserId();
console.info("electLastVisibleVideo: " + id); logger.info("electLastVisibleVideo: " + id);
return id; return id;
}, },
@ -438,7 +439,7 @@ var VideoLayout = {
// FIXME: what does this do??? // FIXME: what does this do???
remoteVideoActive(videoElement, resourceJid) { remoteVideoActive(videoElement, resourceJid) {
console.info(resourceJid + " video is now active", videoElement); logger.info(resourceJid + " video is now active", videoElement);
VideoLayout.resizeThumbnails( VideoLayout.resizeThumbnails(
false, false, function() {$(videoElement).show();}); false, false, function() {$(videoElement).show();});
@ -736,11 +737,11 @@ var VideoLayout = {
if (resourceJid && if (resourceJid &&
lastNEndpoints.indexOf(resourceJid) < 0 && lastNEndpoints.indexOf(resourceJid) < 0 &&
localLastNSet.indexOf(resourceJid) < 0) { localLastNSet.indexOf(resourceJid) < 0) {
console.log("Remove from last N", resourceJid); logger.log("Remove from last N", resourceJid);
if (smallVideo) if (smallVideo)
smallVideo.showPeerContainer('hide'); smallVideo.showPeerContainer('hide');
else if (!APP.conference.isLocalId(resourceJid)) else if (!APP.conference.isLocalId(resourceJid))
console.error("No remote video for: " + resourceJid); logger.error("No remote video for: " + resourceJid);
isReceived = false; isReceived = false;
} else if (resourceJid && } else if (resourceJid &&
//TOFIX: smallVideo may be undefined //TOFIX: smallVideo may be undefined
@ -753,7 +754,7 @@ var VideoLayout = {
if (smallVideo) if (smallVideo)
smallVideo.showPeerContainer('avatar'); smallVideo.showPeerContainer('avatar');
else if (!APP.conference.isLocalId(resourceJid)) else if (!APP.conference.isLocalId(resourceJid))
console.error("No remote video for: " + resourceJid); logger.error("No remote video for: " + resourceJid);
isReceived = false; isReceived = false;
} }
@ -780,7 +781,7 @@ var VideoLayout = {
remoteVideo.showPeerContainer('show'); remoteVideo.showPeerContainer('show');
if (!remoteVideo.isVisible()) { if (!remoteVideo.isVisible()) {
console.log("Add to last N", resourceJid); logger.log("Add to last N", resourceJid);
remoteVideo.addRemoteStreamElement(remoteVideo.videoStream); remoteVideo.addRemoteStreamElement(remoteVideo.videoStream);
@ -881,23 +882,23 @@ var VideoLayout = {
removeParticipantContainer (id) { removeParticipantContainer (id) {
// Unlock large video // Unlock large video
if (pinnedId === id) { if (pinnedId === id) {
console.info("Focused video owner has left the conference"); logger.info("Focused video owner has left the conference");
pinnedId = null; pinnedId = null;
} }
if (currentDominantSpeaker === id) { if (currentDominantSpeaker === id) {
console.info("Dominant speaker has left the conference"); logger.info("Dominant speaker has left the conference");
currentDominantSpeaker = null; currentDominantSpeaker = null;
} }
var remoteVideo = remoteVideos[id]; var remoteVideo = remoteVideos[id];
if (remoteVideo) { if (remoteVideo) {
// Remove remote video // Remove remote video
console.info("Removing remote video: " + id); logger.info("Removing remote video: " + id);
delete remoteVideos[id]; delete remoteVideos[id];
remoteVideo.remove(); remoteVideo.remove();
} else { } else {
console.warn("No remote video for " + id); logger.warn("No remote video for " + id);
} }
VideoLayout.resizeThumbnails(); VideoLayout.resizeThumbnails();
@ -908,12 +909,12 @@ var VideoLayout = {
return; return;
} }
console.info("Peer video type changed: ", id, newVideoType); logger.info("Peer video type changed: ", id, newVideoType);
var smallVideo; var smallVideo;
if (APP.conference.isLocalId(id)) { if (APP.conference.isLocalId(id)) {
if (!localVideoThumbnail) { if (!localVideoThumbnail) {
console.warn("Local video not ready yet"); logger.warn("Local video not ready yet");
return; return;
} }
smallVideo = localVideoThumbnail; smallVideo = localVideoThumbnail;
@ -937,7 +938,7 @@ var VideoLayout = {
if (remoteVideo) { if (remoteVideo) {
remoteVideo.connectionIndicator.showMore(); remoteVideo.connectionIndicator.showMore();
} else { } else {
console.info("Error - no remote video for id: " + id); logger.info("Error - no remote video for id: " + id);
} }
} }
}, },
@ -994,7 +995,7 @@ var VideoLayout = {
if (smallVideo) { if (smallVideo) {
smallVideo.avatarChanged(avatarUrl); smallVideo.avatarChanged(avatarUrl);
} else { } else {
console.warn( logger.warn(
"Missed avatar update - no small video yet for " + id "Missed avatar update - no small video yet for " + id
); );
} }

View File

@ -1,4 +1,4 @@
/* global console */ const logger = require("jitsi-meet-logger").getLogger(__filename);
import { redirect } from '../util/helpers'; import { redirect } from '../util/helpers';
@ -45,8 +45,8 @@ export default class ConferenceUrl {
*/ */
this.inviteURL this.inviteURL
= location.protocol + "//" + location.host + location.pathname; = location.protocol + "//" + location.host + location.pathname;
console.info("Stored original conference URL: " + this.originalURL); logger.info("Stored original conference URL: " + this.originalURL);
console.info("Conference URL for invites: " + this.inviteURL); logger.info("Conference URL for invites: " + this.inviteURL);
} }
/** /**
* Obtains the conference invite URL. * Obtains the conference invite URL.
@ -67,7 +67,7 @@ export default class ConferenceUrl {
* Reloads the conference using original URL with all of the parameters. * Reloads the conference using original URL with all of the parameters.
*/ */
reload() { reload() {
console.info("Reloading the conference using URL: " + this.originalURL); logger.info("Reloading the conference using URL: " + this.originalURL);
redirect(this.originalURL); redirect(this.originalURL);
} }
} }

View File

@ -1,3 +1,5 @@
const logger = require("jitsi-meet-logger").getLogger(__filename);
var JSSHA = require('jssha'); var JSSHA = require('jssha');
module.exports = { module.exports = {
@ -22,7 +24,7 @@ module.exports = {
var attemptFirstAddress; var attemptFirstAddress;
config.bosh = config.boshList[idx]; config.bosh = config.boshList[idx];
console.log('Setting config.bosh to ' + config.bosh + logger.log('Setting config.bosh to ' + config.bosh +
' (idx=' + idx + ')'); ' (idx=' + idx + ')');
if (config.boshAttemptFirstList && if (config.boshAttemptFirstList &&
@ -34,10 +36,10 @@ module.exports = {
if (attemptFirstAddress != config.bosh) { if (attemptFirstAddress != config.bosh) {
config.boshAttemptFirst = attemptFirstAddress; config.boshAttemptFirst = attemptFirstAddress;
console.log('Setting config.boshAttemptFirst=' + logger.log('Setting config.boshAttemptFirst=' +
attemptFirstAddress + ' (idx=' + idx + ')'); attemptFirstAddress + ' (idx=' + idx + ')');
} else { } else {
console.log('Not setting boshAttemptFirst, address matches.'); logger.log('Not setting boshAttemptFirst, address matches.');
} }
} }
} }

View File

@ -1,4 +1,5 @@
/* global $, config, interfaceConfig */ /* global $, config, interfaceConfig */
const logger = require("jitsi-meet-logger").getLogger(__filename);
var configUtil = require('./Util'); var configUtil = require('./Util');
@ -16,7 +17,7 @@ var HttpConfig = {
* @param complete * @param complete
*/ */
obtainConfig: function (endpoint, roomName, complete) { obtainConfig: function (endpoint, roomName, complete) {
console.info( logger.info(
"Send config request to " + endpoint + " for room: " + roomName); "Send config request to " + endpoint + " for room: " + roomName);
@ -28,7 +29,7 @@ var HttpConfig = {
data: JSON.stringify({"roomName": roomName}), data: JSON.stringify({"roomName": roomName}),
dataType: 'json', dataType: 'json',
error: function(jqXHR, textStatus, errorThrown) { error: function(jqXHR, textStatus, errorThrown) {
console.error("Get config error: ", jqXHR, errorThrown); logger.error("Get config error: ", jqXHR, errorThrown);
var error = "Get config response status: " + textStatus; var error = "Get config response status: " + textStatus;
complete(false, error); complete(false, error);
}, },
@ -39,7 +40,7 @@ var HttpConfig = {
complete(true); complete(true);
return; return;
} catch (exception) { } catch (exception) {
console.error("Parse config error: ", exception); logger.error("Parse config error: ", exception);
complete(false, exception); complete(false, exception);
} }
} }

View File

@ -1,4 +1,6 @@
/* global config, interfaceConfig, getConfigParamsFromUrl */ /* global config, interfaceConfig, loggingConfig, getConfigParamsFromUrl */
const logger = require("jitsi-meet-logger").getLogger(__filename);
var configUtils = require('./Util'); var configUtils = require('./Util');
var params = {}; var params = {};
@ -25,11 +27,12 @@ var URLProcessor = {
// } // }
var configJSON = { var configJSON = {
config: {}, config: {},
interfaceConfig: {} interfaceConfig: {},
loggingConfig: {}
}; };
for (var key in params) { for (var key in params) {
if (typeof key !== "string") { if (typeof key !== "string") {
console.warn("Invalid config key: ", key); logger.warn("Invalid config key: ", key);
continue; continue;
} }
var confObj = null, confKey; var confObj = null, confKey;
@ -45,6 +48,9 @@ var URLProcessor = {
} else if (key.indexOf("interfaceConfig.") === 0) { } else if (key.indexOf("interfaceConfig.") === 0) {
confObj = configJSON.interfaceConfig; confObj = configJSON.interfaceConfig;
confKey = key.substr("interfaceConfig.".length); confKey = key.substr("interfaceConfig.".length);
} else if (key.indexOf("loggingConfig.") === 0) {
confObj = configJSON.loggingConfig;
confKey = key.substr("loggingConfig.".length);
} }
if (!confObj) if (!confObj)
@ -52,7 +58,8 @@ var URLProcessor = {
confObj[confKey] = params[key]; confObj[confKey] = params[key];
} }
configUtils.overrideConfigJSON(config, interfaceConfig, configJSON); configUtils.overrideConfigJSON(
config, interfaceConfig, loggingConfig, configJSON);
} }
}; };

View File

@ -1,3 +1,5 @@
const logger = require("jitsi-meet-logger").getLogger(__filename);
var ConfigUtil = { var ConfigUtil = {
/** /**
* Method overrides JSON properties in <tt>config</tt> and * Method overrides JSON properties in <tt>config</tt> and
@ -5,6 +7,8 @@ var ConfigUtil = {
* @param config the config object for which we'll be overriding properties * @param config the config object for which we'll be overriding properties
* @param interfaceConfig the interfaceConfig object for which we'll be * @param interfaceConfig the interfaceConfig object for which we'll be
* overriding properties. * overriding properties.
* @param loggingConfig the logging config object for which we'll be
* overriding properties.
* @param newConfig object containing configuration properties. Destination * @param newConfig object containing configuration properties. Destination
* object is selected based on root property name: * object is selected based on root property name:
* { * {
@ -12,11 +16,15 @@ var ConfigUtil = {
* // config.js properties to be * // config.js properties to be
* }, * },
* interfaceConfig: { * interfaceConfig: {
* // interfaceConfig.js properties here * // interface_config.js properties here
* },
* loggingConfig: {
* // logging_config.js properties here
* } * }
* } * }
*/ */
overrideConfigJSON: function (config, interfaceConfig, newConfig) { overrideConfigJSON: function (config,
interfaceConfig, loggingConfig, newConfig) {
var configRoot, key, value, confObj; var configRoot, key, value, confObj;
for (configRoot in newConfig) { for (configRoot in newConfig) {
confObj = null; confObj = null;
@ -24,6 +32,8 @@ var ConfigUtil = {
confObj = config; confObj = config;
} else if (configRoot == "interfaceConfig") { } else if (configRoot == "interfaceConfig") {
confObj = interfaceConfig; confObj = interfaceConfig;
} else if (configRoot == "loggingConfig") {
confObj = loggingConfig;
} else { } else {
continue; continue;
} }
@ -31,10 +41,10 @@ var ConfigUtil = {
for (key in newConfig[configRoot]) { for (key in newConfig[configRoot]) {
value = newConfig[configRoot][key]; value = newConfig[configRoot][key];
if (confObj[key] && typeof confObj[key] !== typeof value) { if (confObj[key] && typeof confObj[key] !== typeof value) {
console.log("Overriding a " + configRoot + logger.log("Overriding a " + configRoot +
" property with a property of different type."); " property with a property of different type.");
} }
console.info("Overriding " + key + " with: " + value); logger.info("Overriding " + key + " with: " + value);
confObj[key] = value; confObj[key] = value;
} }
} }

View File

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

View File

@ -0,0 +1,66 @@
/* global APP */
/**
* Implements logs storage through the CallStats.
*/
export default class JitsiMeetLogStorage {
/**
* Creates new <tt>JitsiMeetLogStorage</tt>
*/
constructor() {
/**
* Counts each log entry, increases on every batch log entry stored.
* @type {number}
*/
this.counter = 1;
}
/**
* @return {boolean} <tt>true</tt> when this storage is ready or
* <tt>false</tt> otherwise.
*/
isReady() {
return APP.logCollectorStarted && APP.conference;
}
/**
* Called by the <tt>LogCollector</tt> to store a series of log lines into
* batch.
* @param {string|object[]}logEntries an array containing strings
* representing log lines or aggregated lines objects.
*/
storeLogs(logEntries) {
if (!APP.conference.isCallstatsEnabled()) {
// Discard the logs if CallStats is not enabled.
return;
}
let logJSON = '{"log' + this.counter + '":"\n';
for (let i = 0, len = logEntries.length; i < len; i++) {
let logEntry = logEntries[i];
if (typeof logEntry === 'object') {
// Aggregated message
logJSON += '(' + logEntry.count + ') ' + logEntry.text + '\n';
} else {
// Regular message
logJSON += logEntry + '\n';
}
}
logJSON += '"}';
this.counter += 1;
// Try catch was used, because there are many variables
// on the way that could be uninitialized if the storeLogs
// attempt would be made very early (which is unlikely)
try {
APP.conference.logJSON(logJSON);
} catch (error) {
// NOTE console is intentional here
console.error(
"Failed to store the logs: ", logJSON, error);
}
}
}

View File

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

View File

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