From 4bc5799c01da68c0b4907f14206051000df7248d Mon Sep 17 00:00:00 2001 From: Anton Georgiev <anto.georgiev@gmail.com> Date: Wed, 31 Jul 2019 08:30:34 -0400 Subject: [PATCH] attempt to capture & log more info on client errors --- bigbluebutton-html5/client/main.jsx | 7 +++- .../ui/components/join-handler/component.jsx | 1 + .../imports/ui/services/api/index.js | 37 +++++++++++-------- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/bigbluebutton-html5/client/main.jsx b/bigbluebutton-html5/client/main.jsx index 89d2e42351..893beb2ef4 100755 --- a/bigbluebutton-html5/client/main.jsx +++ b/bigbluebutton-html5/client/main.jsx @@ -23,7 +23,12 @@ Meteor.startup(() => { if (!stack.includes(message)) { stack = `${message}\n${stack}`; } - logger.error({ logCode: 'startup_error', stackTrace: stack }, message); + logger.error({ + logCode: 'startup_error', + extraInfo: { + stackTrace: stack, + }, + }, message); }); // TODO make this a Promise diff --git a/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx b/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx index 2653ca7dc8..91f8836422 100644 --- a/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/join-handler/component.jsx @@ -49,6 +49,7 @@ class JoinHandler extends Component { logger.error({ logCode: 'joinhandler_component_fetchToken_not_connected', extraInfo: { + attemptForUserInfo: Auth.fullInfo, numFetchTokenRetries: this.numFetchTokenRetries, }, }, 'Meteor was not connected, retry in a few moments'); diff --git a/bigbluebutton-html5/imports/ui/services/api/index.js b/bigbluebutton-html5/imports/ui/services/api/index.js index fc4f155d8c..880584aeae 100755 --- a/bigbluebutton-html5/imports/ui/services/api/index.js +++ b/bigbluebutton-html5/imports/ui/services/api/index.js @@ -1,6 +1,24 @@ import Auth from '/imports/ui/services/auth'; import { check } from 'meteor/check'; import { notify } from '/imports/ui/services/notification'; +import logger from '/imports/startup/client/logger'; + +export function log(type = 'error', message, ...args) { + const logContents = { ...args }; + const topic = logContents[0] ? logContents[0].topic : null; + + const messageOrStack = message.stack || message.message || JSON.stringify(message); + console.debug(`CLIENT LOG (${topic ? `${type.toUpperCase()}.${topic}` : type.toUpperCase()}): `, messageOrStack, ...args); + + logger[type]({ + logCode: 'services_api_log', + extraInfo: { + message, + logContents, + attemptForUserInfo: Auth.fullInfo, + }, + }, 'Client log from ui/services/api/index.js'); +} /** * Send the request to the server via Meteor.call and don't treat errors. @@ -25,7 +43,9 @@ export function makeCall(name, ...args) { resolve(result); }); } else { - reject(new Error('Meteor was not connected')); + const error = new Error('Meteor was not connected'); + log('error', error); + reject(error); } }); } @@ -44,18 +64,3 @@ export function call(name, ...args) { throw e; }); } - -export function log(type = 'error', message, ...args) { - const { credentials } = Auth; - - const logContents = { ...args }; - const topic = logContents[0] ? logContents[0].topic : null; - - const messageOrStack = message.stack || message.message || JSON.stringify(message); - console.debug(`CLIENT LOG (${topic ? `${type.toUpperCase()}.${topic}` : type.toUpperCase()}): `, messageOrStack, ...args); - - Meteor.call('logClient', type, messageOrStack, { - credentials, - ...args, - }); -} -- GitLab