Skip to content

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

feat(logging): replace console.* with centralized logger infrastructure (#16655)

srijan048d12de24d6
diff --git a/react/features/base/tracks/actions.native.ts b/react/features/base/tracks/actions.native.ts
index b4be80f444..9fc468f89a 100644
--- a/react/features/base/tracks/actions.native.ts
+++ b/react/features/base/tracks/actions.native.ts
@@ -6,6 +6,7 @@ import { setScreenshareMuted } from '../media/actions';
import { addLocalTrack, replaceLocalTrack } from './actions.any';
import { getLocalDesktopTrack, getTrackState } from './functions.native';
+import logger from './logger';
export * from './actions.any';
@@ -63,6 +64,6 @@ async function _startScreenSharing(dispatch: IStore['dispatch'], state: IReduxSt
}, NOTIFICATION_TIMEOUT_TYPE.LONG));
}
} catch (error: any) {
- console.log('ERROR creating screen-sharing stream ', error);
+ logger.error('Error creating screen-sharing stream', error);
}
}
diff --git a/react/features/chat/components/web/MessageMenu.tsx b/react/features/chat/components/web/MessageMenu.tsx
index 64a995efc6..3645718bdb 100644
--- a/react/features/chat/components/web/MessageMenu.tsx
+++ b/react/features/chat/components/web/MessageMenu.tsx
@@ -12,6 +12,7 @@ import Button from '../../../base/ui/components/web/Button';
import { BUTTON_TYPES } from '../../../base/ui/constants.any';
import { copyText } from '../../../base/util/copyText.web';
import { handleLobbyChatInitialized, openChat } from '../../actions.web';
+import logger from '../../logger';
export interface IProps {
className?: string;
@@ -125,11 +126,11 @@ const MessageMenu = ({ message, participantId, isFromVisitor, isLobbyMessage, en
setShowCopiedMessage(false);
}, 2000);
} else {
- console.error('Failed to copy text');
+ logger.error('Failed to copy text');
}
})
- .catch(error => {
- console.error('Error copying text:', error);
+ .catch((error: Error) => {
+ logger.error('Error copying text', error);
});
handleClose();
}, [ message ]);
diff --git a/react/features/chat/logger.ts b/react/features/chat/logger.ts
new file mode 100644
index 0000000000..ee4f45f701
--- /dev/null
+++ b/react/features/chat/logger.ts
@@ -0,0 +1,3 @@
+import { getLogger } from '../base/logging/functions';
+
+export default getLogger('app:chat');
diff --git a/react/features/polls/reducer.ts b/react/features/polls/reducer.ts
index fc3399f0ab..3ed3a75cd4 100644
--- a/react/features/polls/reducer.ts
+++ b/react/features/polls/reducer.ts
@@ -11,6 +11,7 @@ import {
RESET_UNREAD_POLLS_COUNT,
SAVE_POLL
} from './actionTypes';
+import logger from './logger';
import { IIncomingAnswerData, IPollData } from './types';
const INITIAL_STATE = {
@@ -87,7 +88,7 @@ ReducerRegistry.register<IPollsState>(STORE_NAME, (state = INITIAL_STATE, action
// if the poll doesn't exist
if (!(pollId in state.polls)) {
- console.warn('requested poll does not exist: pollId ', pollId);
+ logger.warn('Requested poll does not exist', { pollId });
return state;
}