add logging
This commit is contained in:
parent
98c53f5da9
commit
77dd378117
24
app.js
24
app.js
|
@ -409,6 +409,30 @@ function dump(elem, filename){
|
||||||
/*
|
/*
|
||||||
* Appends the given message to the chat conversation.
|
* Appends the given message to the chat conversation.
|
||||||
*/
|
*/
|
||||||
|
// <a onclick="dump(event.target);">my download button</a>
|
||||||
|
function dump(elem, filename){
|
||||||
|
elem.download = filename || 'xmpplog.json';
|
||||||
|
elem.href = 'data:application/json;charset=utf-8,\n';
|
||||||
|
var data = {};
|
||||||
|
data.time = new Date();
|
||||||
|
data.url = window.location.href;
|
||||||
|
data.ua = navigator.userAgent;
|
||||||
|
if (connection.logger) {
|
||||||
|
data.xmpp = connection.logger.log;
|
||||||
|
}
|
||||||
|
if (connection.jingle) {
|
||||||
|
Object.keys(connection.jingle.sessions).forEach(function (sid) {
|
||||||
|
var session = connection.jingle.sessions[sid];
|
||||||
|
if (session.peerconnection && session.peerconnection.updateLog) {
|
||||||
|
// FIXME: should probably be a .dump call
|
||||||
|
data["jingle_" + session.sid] = session.peerconnection.updateLog;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
elem.href += encodeURIComponent(JSON.stringify(data, null, ' '));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function updateChatConversation(nick, message)
|
function updateChatConversation(nick, message)
|
||||||
{
|
{
|
||||||
var divClassName = '';
|
var divClassName = '';
|
||||||
|
|
Loading…
Reference in New Issue