Reduce the priority of debugging messages going to the console

These messages are in the normal (non-error) path and add to the
cout/cerr noise.

By default, `cfx run` has its output level set to `info` which
excludes the debug messages. To change this, set the
`extensions.sdk.console.logLevel` pref to `debug` or `all`.

https://developer.mozilla.org/Add-ons/SDK/Tools/console#Logging_Levels
This commit is contained in:
Francois Marier 2014-04-24 16:20:44 +12:00
Родитель 749cea2ae6
Коммит 612ff46995
8 изменённых файлов: 24 добавлений и 25 удалений

Просмотреть файл

@ -29,9 +29,9 @@ aggregate.nodemap = {};
aggregate.edgemap = {};
function resetData() {
console.log('aggregate::resetData');
console.debug('aggregate::resetData');
aggregate.getBlockedDomains().forEach(function (domain) {
console.log("deleting", domain);
console.debug("deleting", domain);
delete userSettings[domain];
});
aggregate.nodemap = {};
@ -54,7 +54,7 @@ aggregate.getBlockedDomains = function () {
aggregate.getAllNodes = function () {
var blockedDomains = aggregate.getBlockedDomains();
console.log("getAllNodes", JSON.stringify(blockedDomains));
console.debug("getAllNodes", JSON.stringify(blockedDomains));
return aggregate.nodes.concat(blockedDomains.map(function (domain) {
return {
@ -126,7 +126,7 @@ aggregate.connectionAsObject = function (conn) {
// visualizations.
function onLoad(connections) {
var startTime = Date.now();
console.log("aggregate::onLoad", connections.length, "connections", aggregate.currentFilter);
console.debug("aggregate::onLoad", connections.length, "connections", aggregate.currentFilter);
connections.forEach(onConnection);
aggregate.initialized = true;
filteredAggregate = aggregate.filters[aggregate.currentFilter]();
@ -136,11 +136,11 @@ function onLoad(connections) {
global.currentVisualization.emit('init');
}
updateStatsBar();
console.log('aggregate::onLoad end, took %s ms', Date.now() - startTime);
console.debug('aggregate::onLoad end, took %s ms', Date.now() - startTime);
}
function updateUIFromPrefs(prefs) {
console.log("in aggregate prefs");
console.debug("in aggregate prefs");
global.updateUIFromPrefs(prefs);
}

Просмотреть файл

@ -23,12 +23,12 @@ self.port.on('update-blocklist-all', function (domains) {
});
self.port.on('init', function () {
console.log('content-script::init()');
console.debug('content-script::init()');
global.aggregate.emit('load', global.allConnections);
});
self.port.on("updateUIFromPrefs", function (prefs) {
console.log("Got set prefs", prefs);
console.debug("Got set prefs", prefs);
global.aggregate.emit("updateUIFromPrefs", prefs);
});
})(this);

Просмотреть файл

@ -86,12 +86,12 @@ global.elem = function elem(name, attributes, children) {
};
window.addEventListener('load', function (evt) {
console.log('window onload');
console.debug('window onload');
self.port.emit('uiready');
// Wire up events
document.querySelector('[data-value=Graph]').setAttribute("data-selected", true);
var visualizationName = "graph";
console.log("current vis", visualizationName);
console.debug("current vis", visualizationName);
g.currentVisualization = visualizations[visualizationName];
switchVisualization(visualizationName);
});
@ -102,7 +102,7 @@ function initCap(str) {
global.switchVisualization = function switchVisualization(name) {
// var startTime = Date.now();
console.log('switchVisualizations(' + name + ')');
console.debug('switchVisualizations(' + name + ')');
if (g.currentVisualization != visualizations[name]) {
g.currentVisualization.emit('remove');
}

Просмотреть файл

@ -20,7 +20,7 @@ list.on("showFilteredTable", function (filter) {
list.on('reset', onReset);
function onReset() {
console.log("reset list");
console.debug("reset list");
breadcrumbStack = [];
onRemove();
aggregate.emit('load', global.allConnections);
@ -302,7 +302,7 @@ function resetSelectedRows() {
var lastFilter = null;
function showFilteredTable(filter) {
console.log("showFilteredTable", filter);
console.debug("showFilteredTable", filter);
if (lastFilter != filter) updateBreadcrumb(filter);
lastFilter = filter;
// remove existing table tbodys, if any
@ -311,7 +311,7 @@ function showFilteredTable(filter) {
var tbodyParent = tbody.parentElement;
tbodyParent.removeChild(tbody);
var nodes = getNodes(filter);
console.log("getNodes", nodes);
console.debug("getNodes", nodes);
tbodyParent.appendChild(createBody(nodes));
// update other UI elements
document.querySelector('.selected-header').checked = false;

Просмотреть файл

@ -467,7 +467,7 @@ function updateUIFromPrefs(event) {
if ("defaultVisualization" in event) {
global.currentVisualization = visualizations[event["defaultVisualization"]];
if (global.currentVisualization) {
console.log("Got viz");
console.debug("Got viz");
} else {
console.error("NO viz");
}

Просмотреть файл

@ -38,12 +38,11 @@ function addConnection(connection) {
if (connBatch.length == connBatchSize) {
flushToStorage();
}
console.log("got", connBatch.length, "connections");
console.debug("got", connBatch.length, "connections");
}
exports.getAllConnections = function getAllConnections() {
console.log("got", connBatch.length, "buffered connections",
ss.storage.connections.length, "persisted connections");
console.debug("got", connBatch.length, "buffered connections", ss.storage.connections.length, "persisted connections");
return ss.storage.connections.concat(connBatch);
}
@ -54,7 +53,7 @@ function excludePrivateConnections(connections) {
}
function flushToStorage() {
console.log("flushing", connBatch.length, "buffered connections");
console.debug("flushing", connBatch.length, "buffered connections");
persist.storeConnections(excludePrivateConnections(connBatch));
connBatch.length = 0;
}
@ -145,7 +144,7 @@ Connection.prototype.restoreFromSubject = function (event) {
try {
var tab = getTabForChannel(channel);
} catch (e) {
console.log('EXCEPTION CAUGHT: No tab for connection');
console.debug('EXCEPTION CAUGHT: No tab for connection');
tab = null;
}
var isAjax = getAjaxRequestHeader(channel);

Просмотреть файл

@ -25,7 +25,7 @@ function serializeConnections(connections) {
}
function upload(connections) {
console.log("received upload event in addon");
console.debug("received upload event in addon");
let uploadServer = 'https://data.mozilla.com/submit/lightbeam';
let request = Request({
url: uploadServer,
@ -33,7 +33,7 @@ function upload(connections) {
onComplete: function (response) {
let status = Number(response.status);
if (status >= 200 && status < 300) {
console.log("successful upload: ", response.text);
console.debug("successful upload: ", response.text);
} else {
// Ignore errors for now. We could save last upload time and try
// uploading again the ones that failed previously.

Просмотреть файл

@ -128,7 +128,7 @@ function hasPrivateTab() {
// Connect the tab to the content script of the UI page. There may only ever be
// one UI page.
function attachToLightbeamPage(worker) {
console.log("Attaching to lightbeam page");
console.debug("Attaching to lightbeam page");
uiworker = worker;
// The blocklist is maintained on both sides to reduce latency. However,
@ -259,7 +259,7 @@ exports.openOrSwitchToOrClose = openOrSwitchToOrClose;
// Set up the status bar button to open the main UI page:
var button;
if (usingAustralis) {
console.log("Using australis");
console.debug("Using australis");
button = ActionButton({
id: "lightbeam_Widget",
label: "Lightbeam",
@ -275,7 +275,7 @@ if (usingAustralis) {
}
});
} else {
console.log("Not using australis");
console.debug("Not using australis");
button = Widget({
id: "lightbeam_Widget",
label: "Lightbeam",