Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Replace console with logger

Bettenbuk Zoltanb41bf22be7d6
diff --git a/react/features/always-on-top/AudioMuteButton.js b/react/features/always-on-top/AudioMuteButton.js
index 910aba311f..db03974b4e 100644
--- a/react/features/always-on-top/AudioMuteButton.js
+++ b/react/features/always-on-top/AudioMuteButton.js
@@ -4,6 +4,7 @@ import { AbstractAudioMuteButton } from '../base/toolbox';
import type { AbstractButtonProps as Props } from '../base/toolbox';
const { api } = window.alwaysOnTop;
+const logger = require('jitsi-meet-logger').getLogger(__filename);
/**
* The type of the React {@code Component} state of {@link AudioMuteButton}.
@@ -68,7 +69,7 @@ export default class AudioMuteButton
audioAvailable,
audioMuted
}))
- .catch(console.error);
+ .catch(logger.error);
}
/**
diff --git a/react/features/always-on-top/VideoMuteButton.js b/react/features/always-on-top/VideoMuteButton.js
index 15d511518e..c0ffb46184 100644
--- a/react/features/always-on-top/VideoMuteButton.js
+++ b/react/features/always-on-top/VideoMuteButton.js
@@ -4,6 +4,7 @@ import { AbstractVideoMuteButton } from '../base/toolbox';
import type { AbstractButtonProps as Props } from '../base/toolbox';
const { api } = window.alwaysOnTop;
+const logger = require('jitsi-meet-logger').getLogger(__filename);
/**
* The type of the React {@code Component} state of {@link VideoMuteButton}.
@@ -68,7 +69,7 @@ export default class VideoMuteButton
videoAvailable,
videoMuted
}))
- .catch(console.error);
+ .catch(logger.error);
}
/**
diff --git a/react/features/app/components/App.native.js b/react/features/app/components/App.native.js
index f622fa2029..fdea2d7cb8 100644
--- a/react/features/app/components/App.native.js
+++ b/react/features/app/components/App.native.js
@@ -26,6 +26,8 @@ import type { Props as AbstractAppProps } from './AbstractApp';
declare var __DEV__;
+const logger = require('jitsi-meet-logger').getLogger(__filename);
+
/**
* The type of React {@code Component} props of {@link App}.
*/
@@ -196,7 +198,7 @@ function _handleException(error, fatal) {
// an unhandled JavascriptException for an unhandled JavaScript error.
// This will effectively kill the app. In accord with the Web, do not
// kill the app.
- console.error(error);
+ logger.error(error);
} else {
// Forward to the next globalHandler of ErrorUtils.
const { next } = _handleException;
diff --git a/react/features/base/conference/functions.js b/react/features/base/conference/functions.js
index 28034d73e8..5b11456812 100644
--- a/react/features/base/conference/functions.js
+++ b/react/features/base/conference/functions.js
@@ -11,6 +11,8 @@ import {
JITSI_CONFERENCE_URL_KEY
} from './constants';
+const logger = require('jitsi-meet-logger').getLogger(__filename);
+
/**
* Attach a set of local tracks to a conference.
*
@@ -172,7 +174,7 @@ export function _removeLocalTracksFromConference(
function _reportError(msg, err) {
// TODO This is a good point to call some global error handler when we have
// one.
- console.error(msg, err);
+ logger.error(msg, err);
}
/**
diff --git a/react/features/base/conference/middleware.js b/react/features/base/conference/middleware.js
index 25aab5587e..23eef2506f 100644
--- a/react/features/base/conference/middleware.js
+++ b/react/features/base/conference/middleware.js
@@ -493,7 +493,7 @@ function _setLastN({ getState }, next, action) {
try {
conference.setLastN(action.lastN);
} catch (err) {
- console.error(`Failed to set lastN: ${err}`);
+ logger.error(`Failed to set lastN: ${err}`);
}
}
diff --git a/react/features/base/lib-jitsi-meet/functions.js b/react/features/base/lib-jitsi-meet/functions.js
index 1301ea1ab7..d00e76bc27 100644
--- a/react/features/base/lib-jitsi-meet/functions.js
+++ b/react/features/base/lib-jitsi-meet/functions.js
@@ -10,6 +10,8 @@ declare var APP: Object;
const JitsiConferenceErrors = JitsiMeetJS.errors.conference;
const JitsiConnectionErrors = JitsiMeetJS.errors.connection;
+const logger = require('jitsi-meet-logger').getLogger(__filename);
+
/**
* Creates a {@link JitsiLocalTrack} model from the given device id.
*
@@ -133,7 +135,7 @@ export function loadConfig(
return config;
})
.catch(err => {
- console.error(`Failed to load config from ${url}`, err);
+ logger.error(`Failed to load config from ${url}`, err);
throw err;
});
diff --git a/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js b/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js
index 0db4e88036..30e765e395 100644
--- a/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js
+++ b/react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js
@@ -3,6 +3,8 @@
import { NativeModules } from 'react-native';
import { RTCPeerConnection, RTCSessionDescription } from 'react-native-webrtc';
+const logger = require('jitsi-meet-logger').getLogger(__filename);
+
/* eslint-disable no-unused-vars */
// Address families.
@@ -140,7 +142,7 @@ _RTCPeerConnection.prototype.setRemoteDescription = function(
* @returns {void}
*/
function _LOGE(...args) {
- console && console.error && console.error(...args);
+ logger.error(...args);
}
/**
diff --git a/react/features/base/tracks/functions.js b/react/features/base/tracks/functions.js
index c81443e5ac..fc7e16c07f 100644
--- a/react/features/base/tracks/functions.js
+++ b/react/features/base/tracks/functions.js
@@ -233,7 +233,7 @@ export function setTrackMuted(track, muted) {
// Track might be already disposed so ignore such an error.
if (error.name !== JitsiTrackErrors.TRACK_IS_DISPOSED) {
// FIXME Emit mute failed, so that the app can show error dialog.
- console.error(`set track ${f} failed`, error);
+ logger.error(`set track ${f} failed`, error);
}
});
}
diff --git a/react/features/base/util/uri.js b/react/features/base/util/uri.js
index 5ffaa3c6b8..b2653f6168 100644
--- a/react/features/base/util/uri.js
+++ b/react/features/base/util/uri.js
@@ -1,5 +1,7 @@
// @flow
+const logger = require('jitsi-meet-logger').getLogger(__filename);
+
/**
* The app linking scheme.
* TODO: This should be read from the manifest files later.
@@ -174,7 +176,7 @@ function _objectToURLParamsArray(obj = {}) {
params.push(
`${key}=${encodeURIComponent(JSON.stringify(obj[key]))}`);
} catch (e) {
- console.warn(`Error encoding ${key}: ${e}`);
+ logger.warn(`Error encoding ${key}: ${e}`);
}
}
diff --git a/react/features/mobile/audio-mode/middleware.js b/react/features/mobile/audio-mode/middleware.js
index daa3035084..2550913eae 100644
--- a/react/features/mobile/audio-mode/middleware.js
+++ b/react/features/mobile/audio-mode/middleware.js
@@ -1,4 +1,4 @@
-/* @flow */
+// @flow
import { NativeModules } from 'react-native';
@@ -11,7 +11,8 @@ import {
} from '../../base/conference';
import { MiddlewareRegistry } from '../../base/redux';
-const AudioMode = NativeModules.AudioMode;
+const { AudioMode } = NativeModules;
+const logger = require('jitsi-meet-logger').getLogger(__filename);
/**
* Middleware that captures conference actions and sets the correct audio mode
@@ -59,7 +60,7 @@ MiddlewareRegistry.register(({ getState }) => next => action => {
if (typeof mode !== 'undefined') {
AudioMode.setMode(mode)
.catch(err =>
- console.error(
+ logger.error(
`Failed to set audio mode ${String(mode)}: ${err}`));
}
}
diff --git a/react/features/mobile/picture-in-picture/actions.js b/react/features/mobile/picture-in-picture/actions.js
index 015776296a..4d8ab349a6 100644
--- a/react/features/mobile/picture-in-picture/actions.js
+++ b/react/features/mobile/picture-in-picture/actions.js
@@ -7,6 +7,8 @@ import { Platform } from '../../base/react';
import { ENTER_PICTURE_IN_PICTURE } from './actionTypes';
+const logger = require('jitsi-meet-logger').getLogger(__filename);
+
/**
* Enters (or rather initiates entering) picture-in-picture.
* Helper function to enter PiP mode. This is triggered by user request
@@ -34,7 +36,7 @@ export function enterPictureInPicture() {
p.then(
() => dispatch({ type: ENTER_PICTURE_IN_PICTURE }),
- e => console.warn(`Error entering PiP mode: ${e}`));
+ e => logger.warn(`Error entering PiP mode: ${e}`));
}
};
}
diff --git a/react/features/share-room/middleware.js b/react/features/share-room/middleware.js
index 0aa42f4268..1c7e9d08db 100644
--- a/react/features/share-room/middleware.js
+++ b/react/features/share-room/middleware.js
@@ -8,6 +8,8 @@ import { MiddlewareRegistry } from '../base/redux';
import { endShareRoom } from './actions';
import { BEGIN_SHARE_ROOM } from './actionTypes';
+const logger = require('jitsi-meet-logger').getLogger(__filename);
+
/**
* Middleware that captures room URL sharing actions and starts the sharing
* process.
@@ -56,7 +58,7 @@ function _shareRoom(roomURL: string, dispatch: Function) {
onFulfilled(value.action === Share.sharedAction);
},
/* onRejected */ reason => {
- console.error(
+ logger.error(
`Failed to share conference/room URL ${roomURL}:`,
reason);
onFulfilled(false);
diff --git a/react/index.native.js b/react/index.native.js
index fd800c7c2e..f57e1458eb 100644
--- a/react/index.native.js
+++ b/react/index.native.js
@@ -21,6 +21,8 @@ import { App } from './features/app';
import { equals } from './features/base/redux';
import { IncomingCallApp } from './features/mobile/incoming-call';
+const logger = require('jitsi-meet-logger').getLogger(__filename);
+
/**
* The type of the React {@code Component} props of {@link Root}.
*/
@@ -74,7 +76,7 @@ class Root extends Component<Props, State> {
}
})
.catch(err => {
- console.error('Failed to get initial URL', err);
+ logger.error('Failed to get initial URL', err);
if (typeof this.state.url === 'undefined') {
// Start with an empty URL if getting the initial URL