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();
This commit is contained in:
damencho 2016-09-21 15:46:10 -05:00
parent 4fdc11c6fb
commit bbc7aedb48
1 changed files with 24 additions and 0 deletions

View File

@ -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