diff --git a/app.js b/app.js
index bbb1288b3..cfec93da2 100644
--- a/app.js
+++ b/app.js
@@ -1,5 +1,6 @@
/* global $, config, getRoomName */
/* application specific logic */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
import "babel-polyfill";
import "jquery";
@@ -42,7 +43,7 @@ function pushHistoryState(roomName, URL) {
'VideoChat', `Room: ${roomName}`, URL
);
} catch (e) {
- console.warn("Push history state failed with parameters:",
+ logger.warn("Push history state failed with parameters:",
'VideoChat', `Room: ${roomName}`, URL, e);
return e;
}
@@ -145,7 +146,7 @@ function init() {
}).catch(function (err) {
APP.UI.hideRingOverLay();
APP.API.notifyConferenceLeft(APP.conference.roomName);
- console.error(err);
+ logger.error(err);
});
}
}
@@ -169,7 +170,7 @@ function obtainConfigAndInit() {
if (success) {
var now = APP.connectionTimes["configuration.fetched"] =
window.performance.now();
- console.log("(TIME) configuration fetched:\t", now);
+ logger.log("(TIME) configuration fetched:\t", now);
init();
} else {
// Show obtain config error,
@@ -189,7 +190,7 @@ function obtainConfigAndInit() {
$(document).ready(function () {
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();
APP.init();
diff --git a/conference.js b/conference.js
index a3409ca4c..6e084e682 100644
--- a/conference.js
+++ b/conference.js
@@ -1,4 +1,6 @@
/* global $, APP, JitsiMeetJS, config, interfaceConfig */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
import {openConnection} from './connection';
import Invite from './modules/UI/invite/Invite';
import ContactList from './modules/UI/side_pannels/contactlist/ContactList';
@@ -166,7 +168,7 @@ function muteLocalMedia(localMedia, muted, localMediaTypeString) {
const method = muted ? 'mute' : 'unmute';
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;
}).catch(function (err) {
- console.error(
+ logger.error(
'failed to create local tracks', options.devices, err);
return Promise.reject(err);
});
@@ -310,7 +312,7 @@ class ConferenceConnector {
this._reject(err);
}
_onConferenceFailed(err, ...params) {
- console.error('CONFERENCE FAILED:', err, ...params);
+ logger.error('CONFERENCE FAILED:', err, ...params);
APP.UI.hideRingOverLay();
switch (err) {
// room is locked by the password
@@ -398,7 +400,7 @@ class ConferenceConnector {
}
}
_onConferenceError(err, ...params) {
- console.error('CONFERENCE Error:', err, params);
+ logger.error('CONFERENCE Error:', err, params);
switch (err) {
case ConferenceErrors.CHAT_ERROR:
{
@@ -407,7 +409,7 @@ class ConferenceConnector {
}
break;
default:
- console.error("Unknown error.");
+ logger.error("Unknown error.", err);
}
}
_unsubscribe() {
@@ -493,7 +495,7 @@ export default {
analytics.init();
return createInitialLocalTracksAndConnect(options.roomName);
}).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;
this._bindConnectionFailedHandler(con);
this._createRoom(tracks);
@@ -546,7 +548,7 @@ export default {
// - item-not-found
// - connection dropped(closed by Strophe unexpectedly
// possible due too many transport errors)
- console.error("XMPP connection error: " + errMsg);
+ logger.error("XMPP connection error: " + errMsg);
APP.UI.showPageReloadOverlay();
connection.removeEventListener(
ConnectionEvents.CONNECTION_FAILED, handler);
@@ -876,7 +878,7 @@ export default {
} else if (track.isVideoTrack()) {
return this.useVideoStream(track);
} else {
- console.error(
+ logger.error(
"Ignored not an audio nor a video track: ", track);
return Promise.resolve();
}
@@ -968,11 +970,11 @@ export default {
videoSwitchInProgress: false,
toggleScreenSharing (shareScreen = !this.isSharingScreen) {
if (this.videoSwitchInProgress) {
- console.warn("Switch in progress.");
+ logger.warn("Switch in progress.");
return;
}
if (!this.isDesktopSharingEnabled) {
- console.warn("Cannot toggle screen sharing: not supported.");
+ logger.warn("Cannot toggle screen sharing: not supported.");
return;
}
@@ -1026,7 +1028,7 @@ export default {
this.videoSwitchInProgress = false;
JitsiMeetJS.analytics.sendEvent(
'conference.sharingDesktop.start');
- console.log('sharing local desktop');
+ logger.log('sharing local desktop');
}).catch((err) => {
// close external installation dialog to show the error.
if(externalInstallation)
@@ -1038,7 +1040,7 @@ export default {
return;
}
- console.error('failed to share local desktop', err);
+ logger.error('failed to share local desktop', err);
if (err.name === TrackErrors.FIREFOX_EXTENSION_NEEDED) {
APP.UI.showExtensionRequiredDialog(
@@ -1075,11 +1077,11 @@ export default {
this.videoSwitchInProgress = false;
JitsiMeetJS.analytics.sendEvent(
'conference.sharingDesktop.stop');
- console.log('sharing local video');
+ logger.log('sharing local video');
}).catch((err) => {
this.useVideoStream(null);
this.videoSwitchInProgress = false;
- console.error('failed to share local video', err);
+ logger.error('failed to share local video', err);
});
}
},
@@ -1105,7 +1107,7 @@ export default {
if (user.isHidden())
return;
- console.log('USER %s connnected', id, user);
+ logger.log('USER %s connnected', id, user);
APP.API.notifyUserJoined(id);
APP.UI.addUser(user);
@@ -1113,7 +1115,7 @@ export default {
APP.UI.updateUserRole(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.UI.removeUser(id, user.getDisplayName());
APP.UI.onSharedVideoStop(id);
@@ -1122,7 +1124,7 @@ export default {
room.on(ConferenceEvents.USER_ROLE_CHANGED, (id, role) => {
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()) {
this.isModerator = room.isModerator();
APP.UI.updateLocalRole(room.isModerator());
@@ -1180,7 +1182,7 @@ export default {
{
this.audioLevelsMap[id] = lvl;
if(config.debugAudioLevels)
- console.log("AudioLevel:" + id + "/" + lvl);
+ logger.log("AudioLevel:" + id + "/" + lvl);
}
APP.UI.setAudioLevel(id, lvl);
@@ -1261,7 +1263,7 @@ export default {
});
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);
});
@@ -1497,7 +1499,7 @@ export default {
})
.then(([stream]) => {
this.useVideoStream(stream);
- console.log('switched local video device');
+ logger.log('switched local video device');
APP.settings.setCameraDeviceId(cameraDeviceId, true);
})
.catch((err) => {
@@ -1519,7 +1521,7 @@ export default {
})
.then(([stream]) => {
this.useAudioStream(stream);
- console.log('switched local audio device');
+ logger.log('switched local audio device');
APP.settings.setMicDeviceId(micDeviceId, true);
})
.catch((err) => {
@@ -1535,9 +1537,9 @@ export default {
JitsiMeetJS.analytics.sendEvent(
'settings.changeDevice.audioOut');
APP.settings.setAudioOutputDeviceId(audioOutputDeviceId)
- .then(() => console.log('changed audio output device'))
+ .then(() => logger.log('changed audio output device'))
.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 ' +
'will be used instead.', err);
APP.UI.setSelectedAudioOutputFromSettings();
diff --git a/connection.js b/connection.js
index 81ecec3de..74da7bacb 100644
--- a/connection.js
+++ b/connection.js
@@ -1,4 +1,6 @@
/* global APP, JitsiMeetJS, config */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
import AuthHandler from './modules/UI/authentication/AuthHandler';
import jitsiLocalStorage from './modules/util/JitsiLocalStorage';
@@ -84,7 +86,7 @@ function connect(id, password, roomName) {
function handleConnectionFailed(err) {
unsubscribe();
- console.error("CONNECTION FAILED:", err);
+ logger.error("CONNECTION FAILED:", err);
reject(err);
}
diff --git a/modules/API/API.js b/modules/API/API.js
index 9ca01ef45..fdc2d1487 100644
--- a/modules/API/API.js
+++ b/modules/API/API.js
@@ -1,4 +1,6 @@
/* global APP, getConfigParamsFromUrl */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
/**
* Implements API class that communicates with external api class
* and provides interface to access Jitsi Meet features by external
@@ -131,13 +133,13 @@ function onSystemMessage(message) {
switch (message.type) {
case "eventStatus":
if(!message.name || !message.value) {
- console.warn("Unknown system message format", message);
+ logger.warn("Unknown system message format", message);
break;
}
events[message.name] = message.value;
break;
default:
- console.warn("Unknown system message type", message);
+ logger.warn("Unknown system message type", message);
}
}
diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js
index 94b28345e..d74acd0ec 100644
--- a/modules/API/external/external_api.js
+++ b/modules/API/external/external_api.js
@@ -1,3 +1,5 @@
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
/**
* Implements API class that embeds Jitsi Meet in external applications.
*/
@@ -72,7 +74,7 @@ function sendMessage(postis, object) {
*/
function changeEventStatus(postis, event, status) {
if(!(event in events)) {
- console.error("Not supported event name.");
+ logger.error("Not supported event name.");
return;
}
sendMessage(postis, {
@@ -174,7 +176,7 @@ function JitsiMeetExternalAPI(domain, room_name, width, height, parentNode,
*/
JitsiMeetExternalAPI.prototype.executeCommand = function(name, argumentsList) {
if(!(name in commands)) {
- console.error("Not supported command name.");
+ logger.error("Not supported command name.");
return;
}
var argumentsArray = argumentsList;
@@ -306,7 +308,7 @@ JitsiMeetExternalAPI.prototype.addEventListeners = function(object) {
*/
JitsiMeetExternalAPI.prototype.addEventListener = function(event, listener) {
if(!(event in events)) {
- console.error("Not supported event name.");
+ logger.error("Not supported event name.");
return;
}
// 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) {
if(!(event in this.eventHandlers))
{
- console.error("The event " + event + " is not registered.");
+ logger.error("The event " + event + " is not registered.");
return;
}
delete this.eventHandlers[event];
diff --git a/modules/FollowMe.js b/modules/FollowMe.js
index 8eb1bf40e..a506a7f91 100644
--- a/modules/FollowMe.js
+++ b/modules/FollowMe.js
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+const logger = require("jitsi-meet-logger").getLogger(__filename);
import UIEvents from '../service/UI/UIEvents';
import VideoLayout from './UI/videolayout/VideoLayout';
@@ -308,7 +309,7 @@ class FollowMe {
if (!this._conference.isParticipantModerator(id))
{
- console.warn('Received follow-me command ' +
+ logger.warn('Received follow-me command ' +
'not from moderator');
return;
}
diff --git a/modules/UI/UI.js b/modules/UI/UI.js
index c5bc35eec..4167e286a 100644
--- a/modules/UI/UI.js
+++ b/modules/UI/UI.js
@@ -1,4 +1,6 @@
/* global APP, JitsiMeetJS, $, config, interfaceConfig, toastr */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
var UI = {};
import Chat from "./side_pannels/chat/Chat";
@@ -501,7 +503,7 @@ UI.addLocalStream = function (track) {
VideoLayout.changeLocalVideo(track);
break;
default:
- console.error("Unknown stream type: " + track.getType());
+ logger.error("Unknown stream type: " + track.getType());
break;
}
};
@@ -539,7 +541,7 @@ UI.initEtherpad = function (name) {
if (etherpadManager || !config.etherpad_base || !name) {
return;
}
- console.log('Etherpad is enabled');
+ logger.log('Etherpad is enabled');
etherpadManager
= new EtherpadManager(config.etherpad_base, name, eventEmitter);
Toolbar.showEtherpadButton();
@@ -737,7 +739,7 @@ UI.connectionIndicatorShowMore = function(id) {
// FIXME check if someone user this
UI.showLoginPopup = function(callback) {
- console.log('password is required');
+ logger.log('password is required');
let message = (
` {
- console.log("Received channel password lock change: ", locked,
+ logger.log("Received channel password lock change: ", locked,
error);
if (!locked) {
diff --git a/modules/UI/invite/InviteDialogView.js b/modules/UI/invite/InviteDialogView.js
index ad4cbaed6..51e339d85 100644
--- a/modules/UI/invite/InviteDialogView.js
+++ b/modules/UI/invite/InviteDialogView.js
@@ -1,4 +1,5 @@
/* global $, APP, JitsiMeetJS */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
/**
* Substate for password
@@ -312,7 +313,7 @@ export default class InviteDialogView {
this.blur();
}
catch (err) {
- console.error('error when copy the text');
+ logger.error('error when copy the text');
}
}
});
diff --git a/modules/UI/invite/RoomLocker.js b/modules/UI/invite/RoomLocker.js
index 22dc39a27..da5c0e235 100644
--- a/modules/UI/invite/RoomLocker.js
+++ b/modules/UI/invite/RoomLocker.js
@@ -1,4 +1,6 @@
/* global APP, JitsiMeetJS */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
import RequirePasswordDialog from './RequirePasswordDialog';
/**
@@ -6,7 +8,7 @@ import RequirePasswordDialog from './RequirePasswordDialog';
* because server doesn't support that.
*/
function notifyPasswordNotSupported () {
- console.warn('room passwords not supported');
+ logger.warn('room passwords not supported');
APP.UI.messageHandler.showError(
"dialog.warning", "dialog.passwordNotSupported");
}
@@ -16,7 +18,7 @@ function notifyPasswordNotSupported () {
* @param {Error} err error
*/
function notifyPasswordFailed(err) {
- console.warn('setting password failed', err);
+ logger.warn('setting password failed', err);
APP.UI.messageHandler.showError(
"dialog.lockTitle", "dialog.lockMessage");
}
@@ -64,7 +66,7 @@ export default function createRoomLocker (room) {
if (!password)
lockedElsewhere = false;
}).catch(function (err) {
- console.error(err);
+ logger.error(err);
if (err === ConferenceErrors.PASSWORD_NOT_SUPPORTED) {
notifyPasswordNotSupported();
} else {
@@ -113,7 +115,7 @@ export default function createRoomLocker (room) {
// pass stays between attempts
password = null;
if (reason !== APP.UI.messageHandler.CANCEL)
- console.error(reason);
+ logger.error(reason);
}
);
},
diff --git a/modules/UI/recording/Recording.js b/modules/UI/recording/Recording.js
index 27729ec4f..655345dc3 100644
--- a/modules/UI/recording/Recording.js
+++ b/modules/UI/recording/Recording.js
@@ -14,6 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
import UIEvents from "../../../service/UI/UIEvents";
import UIUtil from '../util/UIUtil';
import VideoLayout from '../videolayout/VideoLayout';
@@ -327,7 +329,7 @@ var Recording = {
}).catch(
reason => {
if (reason !== APP.UI.messageHandler.CANCEL)
- console.error(reason);
+ logger.error(reason);
else
JitsiMeetJS.analytics.sendEvent(
'recording.canceled');
@@ -350,7 +352,7 @@ var Recording = {
}).catch(
reason => {
if (reason !== APP.UI.messageHandler.CANCEL)
- console.error(reason);
+ logger.error(reason);
else
JitsiMeetJS.analytics.sendEvent(
'recording.canceled');
diff --git a/modules/UI/reload_overlay/PageReloadOverlay.js b/modules/UI/reload_overlay/PageReloadOverlay.js
index e15043796..831bd6d40 100644
--- a/modules/UI/reload_overlay/PageReloadOverlay.js
+++ b/modules/UI/reload_overlay/PageReloadOverlay.js
@@ -1,4 +1,5 @@
/* global $, APP, AJS */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
import Overlay from '../overlay/Overlay';
@@ -82,7 +83,7 @@ class PageReloadOverlayImpl extends Overlay{
}
}.bind(this), 1000);
- console.info(
+ logger.info(
"The conference will be reloaded after "
+ this.timeLeft + " seconds.");
}
diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.js
index 622e9f447..0b2e58cbd 100644
--- a/modules/UI/shared_video/SharedVideo.js
+++ b/modules/UI/shared_video/SharedVideo.js
@@ -1,5 +1,6 @@
/* global $, APP, YT, onPlayerReady, onPlayerStateChange, onPlayerError,
JitsiMeetJS */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
import UIUtil from '../util/UIUtil';
import UIEvents from '../../../service/UI/UIEvents';
@@ -75,7 +76,7 @@ export default class SharedVideoManager {
JitsiMeetJS.analytics.sendEvent('sharedvideo.started');
},
err => {
- console.log('SHARED VIDEO CANCELED', err);
+ logger.log('SHARED VIDEO CANCELED', err);
JitsiMeetJS.analytics.sendEvent('sharedvideo.canceled');
}
);
@@ -277,7 +278,7 @@ export default class SharedVideoManager {
};
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
self.errorInPlayer = event.target;
};
@@ -313,7 +314,7 @@ export default class SharedVideoManager {
&& player.getVolume() != 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);
}
@@ -337,7 +338,7 @@ export default class SharedVideoManager {
processTime (player, attributes, forceSeek)
{
if(forceSeek) {
- console.info("Player seekTo:", attributes.time);
+ logger.info("Player seekTo:", attributes.time);
player.seekTo(attributes.time);
return;
}
@@ -349,7 +350,7 @@ export default class SharedVideoManager {
// if we drift more than the interval for checking
// sync, the interval is in milliseconds
if(diff > updateInterval/1000) {
- console.info("Player seekTo:", attributes.time,
+ logger.info("Player seekTo:", attributes.time,
" current time is:", currentPosition, " diff:", diff);
player.seekTo(attributes.time);
}
@@ -669,7 +670,7 @@ SharedVideoThumb.prototype.videoClick = function () {
* Removes RemoteVideo from the page.
*/
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
// corresponding small video.
@@ -686,7 +687,7 @@ SharedVideoThumb.prototype.remove = function () {
*/
SharedVideoThumb.prototype.setDisplayName = function(displayName) {
if (!this.container) {
- console.warn( "Unable to set displayName - " + this.videoSpanId +
+ logger.warn( "Unable to set displayName - " + this.videoSpanId +
" does not exist");
return;
}
diff --git a/modules/UI/side_pannels/contactlist/ContactListView.js b/modules/UI/side_pannels/contactlist/ContactListView.js
index aace25747..93c22dbb7 100644
--- a/modules/UI/side_pannels/contactlist/ContactListView.js
+++ b/modules/UI/side_pannels/contactlist/ContactListView.js
@@ -1,4 +1,6 @@
/* global $, APP, interfaceConfig */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
import Avatar from '../../avatar/Avatar';
import UIEvents from '../../../../service/UI/UIEvents';
import UIUtil from '../../util/UIUtil';
@@ -27,7 +29,7 @@ function updateNumberOfParticipants(delta) {
numberOfContacts += delta;
if (numberOfContacts <= 0) {
- console.error("Invalid number of participants: " + numberOfContacts);
+ logger.error("Invalid number of participants: " + numberOfContacts);
return;
}
diff --git a/modules/UI/util/MessageHandler.js b/modules/UI/util/MessageHandler.js
index 85029bfc3..8c93d436a 100644
--- a/modules/UI/util/MessageHandler.js
+++ b/modules/UI/util/MessageHandler.js
@@ -1,4 +1,5 @@
/* global $, APP, toastr */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
import UIUtil from './UIUtil';
import jitsiLocalStorage from '../../util/JitsiLocalStorage';
@@ -79,7 +80,7 @@ function dontShowTheDialog(options) {
function dontShowAgainSubmitFunctionWrapper(options, submitFunction) {
if(isDontShowAgainEnabled(options)) {
return (...args) => {
- console.debug(args, options.buttonValues);
+ logger.debug(args, options.buttonValues);
//args[1] is the value associated with the pressed button
if(!options.buttonValues || options.buttonValues.length === 0
|| options.buttonValues.indexOf(args[1]) !== -1 ) {
@@ -409,7 +410,7 @@ var messageHandler = {
*/
openReportDialog: function(titleKey, msgKey, error) {
this.openMessageDialog(titleKey, msgKey);
- console.log(error);
+ logger.log(error);
//FIXME send the error to the server
},
diff --git a/modules/UI/videolayout/LargeVideoManager.js b/modules/UI/videolayout/LargeVideoManager.js
index 615c062c8..5dd018586 100644
--- a/modules/UI/videolayout/LargeVideoManager.js
+++ b/modules/UI/videolayout/LargeVideoManager.js
@@ -1,4 +1,5 @@
/* global $, APP, interfaceConfig */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
import Avatar from "../avatar/Avatar";
import {createDeferred} from '../../util/helpers';
@@ -126,7 +127,7 @@ export default class LargeVideoManager {
const { id, stream, videoType, resolve } = this.newStreamData;
this.newStreamData = null;
- console.info("hover in %s", id);
+ logger.info("hover in %s", id);
this.state = videoType;
const container = this.getContainer(this.state);
container.setStream(stream, videoType);
diff --git a/modules/UI/videolayout/LocalVideo.js b/modules/UI/videolayout/LocalVideo.js
index 4fac84b18..79030aedc 100644
--- a/modules/UI/videolayout/LocalVideo.js
+++ b/modules/UI/videolayout/LocalVideo.js
@@ -1,4 +1,6 @@
/* global $, config, interfaceConfig, APP, JitsiMeetJS */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
import ConnectionIndicator from "./ConnectionIndicator";
import UIUtil from "../util/UIUtil";
import UIEvents from "../../../service/UI/UIEvents";
@@ -40,7 +42,7 @@ LocalVideo.prototype.constructor = LocalVideo;
*/
LocalVideo.prototype.setDisplayName = function(displayName) {
if (!this.container) {
- console.warn(
+ logger.warn(
"Unable to set displayName - " + this.videoSpanId +
" does not exist");
return;
diff --git a/modules/UI/videolayout/RemoteVideo.js b/modules/UI/videolayout/RemoteVideo.js
index cecb5d08e..b3256c525 100644
--- a/modules/UI/videolayout/RemoteVideo.js
+++ b/modules/UI/videolayout/RemoteVideo.js
@@ -1,4 +1,5 @@
/* global $, APP, interfaceConfig */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
import ConnectionIndicator from './ConnectionIndicator';
@@ -191,7 +192,7 @@ RemoteVideo.prototype._muteHandler = function () {
}
}).catch(e => {
//currently shouldn't be called
- console.error(e);
+ logger.error(e);
});
this.popover.forceHide();
@@ -343,7 +344,7 @@ RemoteVideo.prototype.removeRemoteStreamElement = function (stream) {
this.wasVideoPlayed = false;
}
- console.info((isVideo ? "Video" : "Audio") +
+ logger.info((isVideo ? "Video" : "Audio") +
" removed " + this.id, select);
// 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
this._figureOutMutedWhileDisconnected(!isActive);
@@ -427,7 +428,7 @@ RemoteVideo.prototype.updateConnectionStatusIndicator = function (isActive) {
* Removes RemoteVideo from the page.
*/
RemoteVideo.prototype.remove = function () {
- console.log("Remove thumbnail", this.id);
+ logger.log("Remove thumbnail", this.id);
this.removeConnectionIndicator();
// Make sure that the large video is updated if are removing its
// corresponding small video.
@@ -586,7 +587,7 @@ RemoteVideo.prototype.hideConnectionIndicator = function () {
*/
RemoteVideo.prototype.setDisplayName = function(displayName) {
if (!this.container) {
- console.warn( "Unable to set displayName - " + this.videoSpanId +
+ logger.warn( "Unable to set displayName - " + this.videoSpanId +
" does not exist");
return;
}
diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js
index 2a5eb0148..f91e33644 100644
--- a/modules/UI/videolayout/SmallVideo.js
+++ b/modules/UI/videolayout/SmallVideo.js
@@ -1,4 +1,6 @@
/* global $, JitsiMeetJS, interfaceConfig */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
import Avatar from "../avatar/Avatar";
import UIUtil from "../util/UIUtil";
import UIEvents from "../../../service/UI/UIEvents";
@@ -503,7 +505,7 @@ SmallVideo.prototype.updateView = function () {
// Init avatar
this.avatarChanged(Avatar.getAvatarUrl(this.id));
} else {
- console.error("Unable to init avatar - no id", this);
+ logger.error("Unable to init avatar - no id", this);
return;
}
}
@@ -561,7 +563,7 @@ SmallVideo.prototype.showDominantSpeakerIndicator = function (show) {
return;
if (!this.container) {
- console.warn( "Unable to set dominant speaker indicator - "
+ logger.warn( "Unable to set dominant speaker indicator - "
+ this.videoSpanId + " does not exist");
return;
}
@@ -589,7 +591,7 @@ SmallVideo.prototype.showDominantSpeakerIndicator = function (show) {
*/
SmallVideo.prototype.showRaisedHandIndicator = function (show) {
if (!this.container) {
- console.warn( "Unable to raised hand indication - "
+ logger.warn( "Unable to raised hand indication - "
+ this.videoSpanId + " does not exist");
return;
}
diff --git a/modules/UI/videolayout/VideoLayout.js b/modules/UI/videolayout/VideoLayout.js
index 65f131387..1d50dc3ad 100644
--- a/modules/UI/videolayout/VideoLayout.js
+++ b/modules/UI/videolayout/VideoLayout.js
@@ -1,4 +1,5 @@
/* global config, APP, $, interfaceConfig */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
import FilmStrip from "./FilmStrip";
import UIEvents from "../../../service/UI/UIEvents";
@@ -261,19 +262,19 @@ var VideoLayout = {
if (lastVisible.length) {
let id = getPeerContainerResourceId(lastVisible[0]);
if (remoteVideos[id]) {
- console.info("electLastVisibleVideo: " + id);
+ logger.info("electLastVisibleVideo: " + id);
return id;
}
// The RemoteVideo was removed (but the DOM elements may still
// exist).
}
- console.info("Last visible video no longer exists");
+ logger.info("Last visible video no longer exists");
thumbs = FilmStrip.getThumbs().remoteThumbs;
if (thumbs.length) {
let id = getPeerContainerResourceId(thumbs[0]);
if (remoteVideos[id]) {
- console.info("electLastVisibleVideo: " + id);
+ logger.info("electLastVisibleVideo: " + id);
return id;
}
// The RemoteVideo was removed (but the DOM elements may
@@ -281,10 +282,10 @@ var VideoLayout = {
}
// Go with local video
- console.info("Fallback to local video...");
+ logger.info("Fallback to local video...");
let id = APP.conference.getMyUserId();
- console.info("electLastVisibleVideo: " + id);
+ logger.info("electLastVisibleVideo: " + id);
return id;
},
@@ -426,7 +427,7 @@ var VideoLayout = {
// FIXME: what does this do???
remoteVideoActive(videoElement, resourceJid) {
- console.info(resourceJid + " video is now active", videoElement);
+ logger.info(resourceJid + " video is now active", videoElement);
VideoLayout.resizeThumbnails(
false, false, function() {$(videoElement).show();});
@@ -724,11 +725,11 @@ var VideoLayout = {
if (resourceJid &&
lastNEndpoints.indexOf(resourceJid) < 0 &&
localLastNSet.indexOf(resourceJid) < 0) {
- console.log("Remove from last N", resourceJid);
+ logger.log("Remove from last N", resourceJid);
if (smallVideo)
smallVideo.showPeerContainer('hide');
else if (!APP.conference.isLocalId(resourceJid))
- console.error("No remote video for: " + resourceJid);
+ logger.error("No remote video for: " + resourceJid);
isReceived = false;
} else if (resourceJid &&
//TOFIX: smallVideo may be undefined
@@ -741,7 +742,7 @@ var VideoLayout = {
if (smallVideo)
smallVideo.showPeerContainer('avatar');
else if (!APP.conference.isLocalId(resourceJid))
- console.error("No remote video for: " + resourceJid);
+ logger.error("No remote video for: " + resourceJid);
isReceived = false;
}
@@ -768,7 +769,7 @@ var VideoLayout = {
remoteVideo.showPeerContainer('show');
if (!remoteVideo.isVisible()) {
- console.log("Add to last N", resourceJid);
+ logger.log("Add to last N", resourceJid);
remoteVideo.addRemoteStreamElement(remoteVideo.videoStream);
@@ -869,23 +870,23 @@ var VideoLayout = {
removeParticipantContainer (id) {
// Unlock large video
if (pinnedId === id) {
- console.info("Focused video owner has left the conference");
+ logger.info("Focused video owner has left the conference");
pinnedId = null;
}
if (currentDominantSpeaker === id) {
- console.info("Dominant speaker has left the conference");
+ logger.info("Dominant speaker has left the conference");
currentDominantSpeaker = null;
}
var remoteVideo = remoteVideos[id];
if (remoteVideo) {
// Remove remote video
- console.info("Removing remote video: " + id);
+ logger.info("Removing remote video: " + id);
delete remoteVideos[id];
remoteVideo.remove();
} else {
- console.warn("No remote video for " + id);
+ logger.warn("No remote video for " + id);
}
VideoLayout.resizeThumbnails();
@@ -896,12 +897,12 @@ var VideoLayout = {
return;
}
- console.info("Peer video type changed: ", id, newVideoType);
+ logger.info("Peer video type changed: ", id, newVideoType);
var smallVideo;
if (APP.conference.isLocalId(id)) {
if (!localVideoThumbnail) {
- console.warn("Local video not ready yet");
+ logger.warn("Local video not ready yet");
return;
}
smallVideo = localVideoThumbnail;
@@ -925,7 +926,7 @@ var VideoLayout = {
if (remoteVideo) {
remoteVideo.connectionIndicator.showMore();
} else {
- console.info("Error - no remote video for id: " + id);
+ logger.info("Error - no remote video for id: " + id);
}
}
},
@@ -982,7 +983,7 @@ var VideoLayout = {
if (smallVideo) {
smallVideo.avatarChanged(avatarUrl);
} else {
- console.warn(
+ logger.warn(
"Missed avatar update - no small video yet for " + id
);
}
diff --git a/modules/URL/ConferenceUrl.js b/modules/URL/ConferenceUrl.js
index 6546f7cd6..c700cc10d 100644
--- a/modules/URL/ConferenceUrl.js
+++ b/modules/URL/ConferenceUrl.js
@@ -1,4 +1,4 @@
-/* global console */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
import { redirect } from '../util/helpers';
@@ -45,8 +45,8 @@ export default class ConferenceUrl {
*/
this.inviteURL
= location.protocol + "//" + location.host + location.pathname;
- console.info("Stored original conference URL: " + this.originalURL);
- console.info("Conference URL for invites: " + this.inviteURL);
+ logger.info("Stored original conference URL: " + this.originalURL);
+ logger.info("Conference URL for invites: " + this.inviteURL);
}
/**
* Obtains the conference invite URL.
@@ -67,7 +67,7 @@ export default class ConferenceUrl {
* Reloads the conference using original URL with all of the parameters.
*/
reload() {
- console.info("Reloading the conference using URL: " + this.originalURL);
+ logger.info("Reloading the conference using URL: " + this.originalURL);
redirect(this.originalURL);
}
}
diff --git a/modules/config/BoshAddressChoice.js b/modules/config/BoshAddressChoice.js
index a2d24b550..1a4ec4b95 100644
--- a/modules/config/BoshAddressChoice.js
+++ b/modules/config/BoshAddressChoice.js
@@ -1,3 +1,5 @@
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
var JSSHA = require('jssha');
module.exports = {
@@ -22,7 +24,7 @@ module.exports = {
var attemptFirstAddress;
config.bosh = config.boshList[idx];
- console.log('Setting config.bosh to ' + config.bosh +
+ logger.log('Setting config.bosh to ' + config.bosh +
' (idx=' + idx + ')');
if (config.boshAttemptFirstList &&
@@ -34,10 +36,10 @@ module.exports = {
if (attemptFirstAddress != config.bosh) {
config.boshAttemptFirst = attemptFirstAddress;
- console.log('Setting config.boshAttemptFirst=' +
+ logger.log('Setting config.boshAttemptFirst=' +
attemptFirstAddress + ' (idx=' + idx + ')');
} else {
- console.log('Not setting boshAttemptFirst, address matches.');
+ logger.log('Not setting boshAttemptFirst, address matches.');
}
}
}
diff --git a/modules/config/HttpConfigFetch.js b/modules/config/HttpConfigFetch.js
index c65607e43..0c7a59884 100644
--- a/modules/config/HttpConfigFetch.js
+++ b/modules/config/HttpConfigFetch.js
@@ -1,4 +1,5 @@
/* global $, config, interfaceConfig */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
var configUtil = require('./Util');
@@ -16,7 +17,7 @@ var HttpConfig = {
* @param complete
*/
obtainConfig: function (endpoint, roomName, complete) {
- console.info(
+ logger.info(
"Send config request to " + endpoint + " for room: " + roomName);
@@ -28,7 +29,7 @@ var HttpConfig = {
data: JSON.stringify({"roomName": roomName}),
dataType: 'json',
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;
complete(false, error);
},
@@ -39,7 +40,7 @@ var HttpConfig = {
complete(true);
return;
} catch (exception) {
- console.error("Parse config error: ", exception);
+ logger.error("Parse config error: ", exception);
complete(false, exception);
}
}
diff --git a/modules/config/URLProcessor.js b/modules/config/URLProcessor.js
index a1de4176d..125d6c1d4 100644
--- a/modules/config/URLProcessor.js
+++ b/modules/config/URLProcessor.js
@@ -1,4 +1,6 @@
/* global config, interfaceConfig, getConfigParamsFromUrl */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
var configUtils = require('./Util');
var params = {};
@@ -29,7 +31,7 @@ var URLProcessor = {
};
for (var key in params) {
if (typeof key !== "string") {
- console.warn("Invalid config key: ", key);
+ logger.warn("Invalid config key: ", key);
continue;
}
var confObj = null, confKey;
diff --git a/modules/config/Util.js b/modules/config/Util.js
index 6267e4fdb..29bf9e599 100644
--- a/modules/config/Util.js
+++ b/modules/config/Util.js
@@ -1,3 +1,5 @@
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
var ConfigUtil = {
/**
* Method overrides JSON properties in config and
@@ -31,10 +33,10 @@ var ConfigUtil = {
for (key in newConfig[configRoot]) {
value = newConfig[configRoot][key];
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.");
}
- console.info("Overriding " + key + " with: " + value);
+ logger.info("Overriding " + key + " with: " + value);
confObj[key] = value;
}
}
diff --git a/modules/settings/Settings.js b/modules/settings/Settings.js
index 5c42cfa75..c0d283618 100644
--- a/modules/settings/Settings.js
+++ b/modules/settings/Settings.js
@@ -1,4 +1,6 @@
/* global JitsiMeetJS */
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
import UIUtil from '../UI/util/UIUtil';
import jitsiLocalStorage from '../util/JitsiLocalStorage';
@@ -37,7 +39,7 @@ if (audioOutputDeviceId !==
JitsiMeetJS.mediaDevices.getAudioOutputDevice()) {
JitsiMeetJS.mediaDevices.setAudioOutputDevice(audioOutputDeviceId)
.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' +
'instead.', ex);
});
diff --git a/modules/util/helpers.js b/modules/util/helpers.js
index 50f92e579..0bd7e9e1f 100644
--- a/modules/util/helpers.js
+++ b/modules/util/helpers.js
@@ -1,3 +1,5 @@
+const logger = require("jitsi-meet-logger").getLogger(__filename);
+
/**
* Create deferred object.
* @returns {{promise, resolve, reject}}
@@ -35,7 +37,7 @@ export function redirect (url) {
* @param msg {string} [optional] the message printed in addition to the error
*/
export function reportError (e, msg = "") {
- console.error(msg, e);
+ logger.error(msg, e);
if(window.onerror)
window.onerror(msg, null, null,
null, e);
diff --git a/package.json b/package.json
index 22d4bee88..f800232bf 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
"haste-resolver-webpack-plugin": "^0.2.2",
"i18next": "3.4.4",
"i18next-xhr-backend": "1.1.0",
+ "jitsi-meet-logger": "jitsi/jitsi-meet-logger",
"jquery": "~2.1.1",
"jquery-contextmenu": "*",
"jquery-i18next": "1.1.0",