Remove string interpolation for server debug and verbose logs

This commit is contained in:
Anton Georgiev 2020-11-23 14:35:59 -05:00
parent b18d038aeb
commit 21644a1a43
44 changed files with 62 additions and 59 deletions

View File

@ -10,7 +10,7 @@ function annotations() {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing Annotations for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing Annotations', { meetingId, requesterUserId });
return Annotations.find({ meetingId });
}

View File

@ -12,7 +12,7 @@ function breakouts(role) {
}
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing Breakouts for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing Breakouts', { meetingId, requesterUserId });
const User = Users.findOne({ userId: requesterUserId, meetingId }, { fields: { role: 1 } });
if (!!User && User.role === ROLE_MODERATOR) {

View File

@ -24,7 +24,7 @@ export default function appendText(text, locale) {
}).then((response) => {
const { status } = response;
if (status === 200) {
Logger.verbose(`Appended text for padId:${padId}`);
Logger.verbose('Captions: appended text', { padId });
}
}).catch(error => Logger.error(`Could not append captions for padId=${padId}: ${error}`));
}

View File

@ -33,10 +33,10 @@ export default function addCaption(meetingId, padId, locale) {
const { insertedId } = numChanged;
if (insertedId) {
return Logger.verbose(`Added caption locale=${locale.locale} meeting=${meetingId}`);
return Logger.verbose('Captions: added locale', { locale: locale.locale, meetingId });
}
return Logger.verbose(`Upserted caption locale=${locale.locale} meeting=${meetingId}`);
return Logger.verbose('Captions: upserted locale', { locale: locale.locale, meetingId });
};
return Captions.upsert(selector, modifier, cb);

View File

@ -21,10 +21,10 @@ export default function updateOwnerId(meetingId, userId, padId) {
const cb = (err) => {
if (err) {
return Logger.error(`Updating captions pad: ${err}`);
return Logger.error('Captions: error while updating pad', { err });
}
updateOwner(meetingId, userId, padId);
return Logger.verbose(`Update captions pad=${padId} ownerId=${userId}`);
return Logger.verbose('Captions: updated caption', { padId, ownerId: userId });
};
return Captions.update(selector, modifier, { multi: true }, cb);

View File

@ -27,7 +27,7 @@ export default function updatePad(padId, data, revs) {
return Logger.error(`Updating captions pad: ${err}`);
}
editCaptions(padId, data, revs);
return Logger.verbose(`Update captions pad=${padId} revs=${revs}`);
return Logger.verbose('Captions: updated pad', { padId, revs });
};
return Captions.update(selector, modifier, { multi: true }, cb);

View File

@ -18,10 +18,10 @@ export default function updateReadOnlyPadId(padId, readOnlyPadId) {
const cb = (err) => {
if (err) {
return Logger.error(`Adding readOnlyPadId captions pad: ${err}`);
return Logger.error('Captions: error when adding readOnlyPadId', { err });
}
return Logger.verbose(`Added readOnlyPadId captions pad=${padId} readOnlyPadId=${readOnlyPadId}`);
return Logger.verbose('Captions: added readOnlyPadId', { padId, readOnlyPadId });
};
return Captions.update(selector, modifier, { multi: true }, cb);

View File

@ -8,7 +8,7 @@ function captions() {
return Captions.find({ meetingId: '' });
}
const { meetingId } = extractCredentials(this.userId);
Logger.debug(`Publishing Captions for ${meetingId}`);
Logger.debug('Publishing Captions', { meetingId });
return Captions.find({ meetingId });
}

View File

@ -18,7 +18,7 @@ const proccess = _.throttle(() => {
CursorStreamer(meetingId).emit('message', { meetingId, cursors });
if (streamerLog) {
Logger.debug(`CursorUpdate process for meeting ${meetingId} has finished`);
Logger.debug('CursorUpdate process has finished', { meetingId });
}
} catch (error) {
Logger.error(`Error while trying to send cursor streamer data for meeting ${meetingId}. ${error}`);

View File

@ -36,7 +36,7 @@ export default function updateCursor(meetingId, whiteboardId, userId, x = -1, y
}
if (numChanged) {
Logger.debug(`Updated cursor meeting=${meetingId}`);
Logger.debug('Updated cursor ', { meetingId });
}
};

View File

@ -11,12 +11,12 @@ export function removeCursorStreamer(meetingId) {
export function addCursorStreamer(meetingId) {
const streamer = new Meteor.Streamer(`cursor-${meetingId}`, { retransmit: false });
if (streamerLog) {
Logger.debug(`Cursor streamer created for meeting ${meetingId}`);
Logger.debug('Cursor streamer created', { meetingId });
}
streamer.allowRead(function allowRead() {
if (streamerLog) {
Logger.debug(`Cursor streamer called allowRead for user ${this.userId} in meeting ${meetingId}`);
Logger.debug('Cursor streamer called allowRead', { userId: this.userId, meetingId });
}
return this.userId && this.userId.includes(meetingId);
});

View File

@ -2,7 +2,6 @@ import { extractCredentials } from '/imports/api/common/server/helpers';
import Logger from '/imports/startup/server/logger';
const allowRecentMessages = (eventName, message) => {
const {
userId,
meetingId,
@ -11,7 +10,7 @@ const allowRecentMessages = (eventName, message) => {
state,
} = message;
Logger.debug(`ExternalVideo Streamer auth allowed userId: ${userId}, meetingId: ${meetingId}, event: ${eventName}, time: ${time} rate: ${rate}, state: ${state}`);
Logger.debug('ExternalVideo Streamer auth allowed', userId, meetingId, eventName, time, rate, state);
return true;
};
@ -26,6 +25,6 @@ export default function initializeExternalVideo() {
streamer.allowEmit(allowRecentMessages);
Logger.info(`Created External Video streamer for ${streamName}`);
} else {
Logger.debug(`External Video streamer is already created for ${streamName}`);
Logger.debug('`External Video streamer is already created', { streamName });
}
}

View File

@ -44,7 +44,7 @@ export default function startTyping(meetingId, userId, chatId) {
Meteor.setTimeout(() => {
stopTyping(meetingId, userId);
}, TYPING_TIMEOUT);
return Logger.debug(`Typing indicator update for userId={${userId}} chatId={${chatId}}`);
return Logger.debug('Typing indicator update', { userId, chatId });
};
return UsersTyping.upsert(selector, mod, cb);

View File

@ -20,7 +20,7 @@ export default function stopTyping(meetingId, userId, sendMsgInitiated = false)
if (err) {
return Logger.error(`Stop user=${userId} typing indicator error: ${err}`);
}
return Logger.debug(`Stopped typing indicator for user=${userId}`);
return Logger.debug('Stopped typing indicator', { userId });
};
UsersTyping.remove(selector, cb);

View File

@ -13,7 +13,7 @@ function groupChatMsg(chatsIds) {
const CHAT_CONFIG = Meteor.settings.public.chat;
const PUBLIC_GROUP_CHAT_ID = CHAT_CONFIG.public_group_id;
Logger.debug(`Publishing group-chat-msg for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing group-chat-msg', { meetingId, requesterUserId });
return GroupChatMsg.find({
$or: [
@ -37,7 +37,7 @@ function usersTyping() {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing users-typing for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing users-typing', { meetingId, requesterUserId });
return UsersTyping.find({ meetingId });
}

View File

@ -13,7 +13,7 @@ function groupChat() {
const CHAT_CONFIG = Meteor.settings.public.chat;
const PUBLIC_CHAT_TYPE = CHAT_CONFIG.type_public;
Logger.debug(`Publishing group-chat for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing group-chat', { meetingId, requesterUserId });
return GroupChat.find({
$or: [

View File

@ -9,7 +9,7 @@ function localSettings() {
}
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing local settings for user=${requesterUserId}`);
Logger.debug('Publishing local settings', { requesterUserId });
return LocalSettings.find({ meetingId, userId: requesterUserId });
}

View File

@ -17,8 +17,7 @@ export default function transferUser(fromMeetingId, toMeetingId) {
userId: requesterUserId,
};
Logger.verbose(`userId ${requesterUserId} was transferred from
meeting ${fromMeetingId}' to meeting '${toMeetingId}`);
Logger.verbose('User was transferred from one meting to another', { requesterUserId, fromMeetingId, toMeetingId });
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
}

View File

@ -12,7 +12,7 @@ function meetings(role) {
}
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing meeting =${meetingId} ${requesterUserId}`);
Logger.debug('Publishing meeting', { meetingId, requesterUserId });
const selector = {
$or: [

View File

@ -14,7 +14,7 @@ export default function userInstabilityDetected(sender) {
sender,
};
Logger.debug(`Receiver ${receiver} reported a network instability in meeting ${meetingId}`);
Logger.debug('Receiver reported a network instability', { receiver, meetingId });
return NetworkInformation.insert(payload);
}

View File

@ -18,10 +18,10 @@ export default function updateNote(noteId, revs) {
const cb = (err) => {
if (err) {
return Logger.error(`Updating note pad: ${err}`);
return Logger.error('Notes: error when updating note pad', { err });
}
return Logger.verbose(`Update note pad=${noteId} revs=${revs}`);
return Logger.verbose('Notes: update note pad', { pad: noteId, revs });
};
return Note.update(selector, modifier, { multi: true }, cb);

View File

@ -13,7 +13,7 @@ function currentPoll() {
meetingId,
};
Logger.debug(`Publishing poll for meeting=${meetingId}`);
Logger.debug('Publishing poll', { meetingId });
return Polls.find(selector);
}
@ -33,7 +33,7 @@ function polls() {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing polls =${meetingId} ${requesterUserId}`);
Logger.debug('Publishing polls', { meetingId, requesterUserId });
const selector = {
meetingId,

View File

@ -8,7 +8,7 @@ function presentationPods() {
return PresentationPods.find({ meetingId: '' });
}
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing presentation-pods for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing presentation-pods', { meetingId, requesterUserId });
return PresentationPods.find({ meetingId });
}

View File

@ -19,7 +19,7 @@ function presentationUploadToken(podId, filename) {
filename,
};
Logger.debug(`Publishing PresentationUploadToken for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing PresentationUploadToken', { meetingId, requesterUserId });
return PresentationUploadToken.find(selector);
}

View File

@ -83,7 +83,7 @@ export default function handlePresentationConversionUpdate({ body }, meetingId)
return Logger.info(`Updated presentation conversion status=${status} id=${presentationId} meeting=${meetingId}`);
}
return Logger.debug(`Upserted presentation conversion status=${status} id=${presentationId} meeting=${meetingId}`);
return Logger.debug('Upserted presentation conversion', { status, presentationId, meetingId });
};
return Presentations.upsert(selector, modifier, cb);

View File

@ -9,7 +9,7 @@ function presentations() {
}
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing Presentations for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing Presentations', { meetingId, requesterUserId });
return Presentations.find({ meetingId });
}

View File

@ -9,7 +9,7 @@ function screenshare() {
}
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing Screenshare for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing Screenshare', { meetingId, requesterUserId });
return Screenshare.find({ meetingId });
}

View File

@ -54,7 +54,7 @@ export default function resizeSlide(meetingId, slide) {
}
if (numChanged) {
return Logger.debug(`Resized slide positions id=${pageId}`);
return true;
}
return Logger.info(`No slide positions found with id=${pageId}`);

View File

@ -8,7 +8,7 @@ function slides() {
return Slides.find({ meetingId: '' });
}
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing Slides for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing Slides', { meetingId, requesterUserId });
return Slides.find({ meetingId });
}
@ -26,7 +26,7 @@ function slidePositions() {
}
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing SlidePositions for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing SlidePositions', { meetingId, requesterUserId });
return SlidePositions.find({ meetingId });
}

View File

@ -9,7 +9,7 @@ function userInfos() {
}
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing user infos requested by user=${requesterUserId}`);
Logger.debug('Publishing user infos requested', { requesterUserId });
return UserInfos.find({ meetingId, requesterUserId });
}

View File

@ -27,7 +27,7 @@ export default function addUserSetting(meetingId, userId, setting, value) {
return Logger.error(`Adding user setting to collection: ${err}`);
}
return Logger.verbose(`Upserted user setting for meetingId=${meetingId} userId=${userId} setting=${setting}`);
return Logger.verbose('Upserted user setting', { meetingId, userId, setting });
};
return UserSettings.upsert(selector, modifier, cb);

View File

@ -33,12 +33,12 @@ function userSettings() {
UserSettings.upsert(selector, doc);
});
Logger.debug(`Publishing user settings for user=${requesterUserId}`);
Logger.debug('Publishing user settings', { requesterUserId });
return UserSettings.find({ meetingId, userId: requesterUserId });
}
Logger.debug(`Publishing user settings for user=${requesterUserId}`);
Logger.debug('Publishing user settings', { requesterUserId });
return UserSettings.find({ meetingId, userId: requesterUserId });
}

View File

@ -29,8 +29,7 @@ export default function assignPresenter(userId) { // TODO-- send username from c
requesterId: requesterUserId,
};
Logger.verbose(`User '${userId}' setted as presenter by '${
requesterUserId}' from meeting '${meetingId}'`);
Logger.verbose('User set as presenter', { userId, meetingId, setBy: requesterUserId });
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
}

View File

@ -20,7 +20,9 @@ export default function changeRole(userId, role) {
changedBy: requesterUserId,
};
Logger.verbose(`User '${userId}' set as '${role} role by '${requesterUserId}' from meeting '${meetingId}'`);
Logger.verbose('Changed user role', {
userId, role, changedBy: requesterUserId, meetingId,
});
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
}

View File

@ -18,8 +18,9 @@ export default function setEmojiStatus(userId, status) {
userId,
};
Logger.verbose(`User '${userId}' emoji status updated to '${status}' by '${
requesterUserId}' from meeting '${meetingId}'`);
Logger.verbose('User emoji status updated', {
userId, status, requesterUserId, meetingId,
});
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
}

View File

@ -21,7 +21,7 @@ export default function setUserEffectiveConnectionType(effectiveConnectionType)
setEffectiveConnectionType(meetingId, requesterUserId, effectiveConnectionType);
Logger.verbose(`User ${requesterUserId} effective connection updated to ${effectiveConnectionType}`);
Logger.verbose('Updated user effective connection', { requesterUserId, effectiveConnectionType });
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
}

View File

@ -21,8 +21,9 @@ export default function toggleUserLock(userId, lock) {
lock,
};
Logger.verbose(`User ${lockedBy} updated lock status from ${userId} to ${lock}
in meeting ${meetingId}`);
Logger.verbose('Updated lock status for user', {
meetingId, userId, lock, lockedBy,
});
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, lockedBy, payload);

View File

@ -79,7 +79,7 @@ function users(role) {
},
};
Logger.debug(`Publishing Users for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing Users', { meetingId, requesterUserId });
return Users.find(selector, options);
}

View File

@ -9,7 +9,7 @@ function videoStreams() {
}
const { meetingId } = extractCredentials(this.userId);
Logger.debug(`video users of meeting id=${meetingId}`);
Logger.debug('Publishing video users', { meetingId });
const selector = {
meetingId,

View File

@ -41,7 +41,9 @@ export default function handleVoiceCallStateEvent({ body }, meetingId) {
return Logger.error(`Update voice call state=${userId}: ${err}`);
}
return Logger.debug(`Update voice call state=${userId} meeting=${meetingId} clientSession=${clientSession} callState=${callState}`);
return Logger.debug('Update voice call', {
state: userId, meetingId, clientSession, callState,
});
};
return VoiceCallState.upsert(selector, modifier, cb);

View File

@ -9,7 +9,7 @@ function voiceCallStates() {
}
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing Voice Call States for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing Voice Call States', { meetingId, requesterUserId });
return VoiceCallStates.find({ meetingId, userId: requesterUserId });
}

View File

@ -48,7 +48,7 @@ export default function updateVoiceUser(meetingId, voiceUser) {
return Logger.error(`Update voiceUser=${intId}: ${err}`);
}
return Logger.debug(`Update voiceUser=${intId} meeting=${meetingId}`);
return Logger.debug('Update voiceUser', { voiceUser: intId, meetingId });
};
if (!voiceUser.talking) {

View File

@ -24,7 +24,7 @@ function voiceUser() {
}
});
Logger.debug(`Publishing Voice User for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing Voice User', { meetingId, requesterUserId });
this._session.socket.on('close', _.debounce(onCloseConnection, 100));
return VoiceUsers.find({ meetingId });

View File

@ -9,7 +9,7 @@ function whiteboardMultiUser() {
}
const { meetingId, requesterUserId } = extractCredentials(this.userId);
Logger.debug(`Publishing whiteboard-multi-user for ${meetingId} ${requesterUserId}`);
Logger.debug('Publishing whiteboard-multi-user', { meetingId, requesterUserId });
return WhiteboardMultiUser.find({ meetingId });
}