From 77dd37811725f8b6e0f615c89cada83c2053819c Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Sun, 22 Dec 2013 19:39:41 +0100 Subject: [PATCH] add logging --- app.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app.js b/app.js index ec3320e99..8b27a68e8 100644 --- a/app.js +++ b/app.js @@ -409,6 +409,30 @@ function dump(elem, filename){ /* * Appends the given message to the chat conversation. */ +// my download button +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) { var divClassName = '';