Bug 908923 - Part 2: Add a button to dump the entire rlog ringbuffer to about:webrtc. r=abr

This commit is contained in:
Byron Campen [:bwc] 2013-11-25 14:38:41 -08:00
parent c2c5f8c8b3
commit 098cdd266f
3 changed files with 19 additions and 3 deletions

View File

@ -171,14 +171,17 @@ WebrtcGlobalInformation.prototype = {
}
},
getCandPairLogs: function(candPairId, callback, errorCallback) {
let pattern = 'CAND-PAIR(' + candPairId + ')';
getLogs: function(pattern, callback, errorCallback) {
if (_globalPCList) {
_globalPCList.getLoggingFromFirstPC(pattern, callback, errorCallback);
} else {
errorCallback("No global PeerConnection list");
}
},
getCandPairLogs: function(candPairId, callback, errorCallback) {
this.getLogs('CAND-PAIR(' + candPairId + ')', callback, errorCallback);
},
};
function RTCIceCandidate() {

View File

@ -150,6 +150,9 @@ interface WebrtcGlobalInformation {
void getCandPairLogs(DOMString candPairId,
RTCLogCallback callback,
RTCPeerConnectionErrorCallback errorCallback);
void getLogs(DOMString pattern,
RTCLogCallback callback,
RTCPeerConnectionErrorCallback errorCallback);
};

View File

@ -24,6 +24,15 @@ function getCandPairLogs(id) {
}
}
function getAllLogs() {
try {
var wg = new WebrtcGlobalInformation();
wg.getLogs('', displayLogs, console.log);
} catch(e) {
console.log("Exception while creating WebrtcGlobalInformation" + e.toString());
}
}
function displayLogs(logs) {
var logsDiv = document.getElementById('logs');
while (logsDiv.lastChild) {
@ -34,7 +43,7 @@ function displayLogs(logs) {
logs.forEach(function(logLine){
logsDiv.appendChild(document.createElement('div'))
.appendChild(document.createTextNode(logLine));
});
});
}
function buildCandPairTableRow(candPair, stats) {
@ -214,6 +223,7 @@ var statsDisplay = setInterval(refreshStats, 1000);
<body id="body" onload="refreshStats()">
<div id="stats">
</div>
<button onclick="getAllLogs()">Show/refresh logging</button>
<div id="logs">
</div>
</body>