From bbc7aedb48dd344f864d2d79b42077db28d86f39 Mon Sep 17 00:00:00 2001 From: damencho Date: Wed, 21 Sep 2016 15:46:10 -0500 Subject: [PATCH] Adds download logs method for debugging. Adds a download logs method that can be called from console to take usefull messages for debugging. console> APP.conference.saveLogs(); --- conference.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/conference.js b/conference.js index 7c6a6f249..0b8307c37 100644 --- a/conference.js +++ b/conference.js @@ -711,6 +711,30 @@ export default { return room.getLogs(); }, + /** + * Download logs, a function that can be called from console while + * debugging. + * @param filename (optional) specify target filename + */ + saveLogs (filename = 'meetlog.json') { + // this can be called from console and will not have reference to this + // that's why we reference the global var + let logs = APP.conference.getLogs(); + let data = encodeURIComponent(JSON.stringify(logs, null, ' ')); + + let elem = document.createElement('a'); + + elem.download = filename; + elem.href = 'data:application/json;charset=utf-8,\n' + data; + elem.dataset.downloadurl + = ['text/json', elem.download, elem.href].join(':'); + elem.dispatchEvent(new MouseEvent('click', { + view: window, + bubbles: true, + cancelable: false + })); + }, + /** * Exposes a Command(s) API on this instance. It is necessitated by (1) the * desire to keep room private to this instance and (2) the need of other