mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 06:38:36 +00:00
Bug 591715: Utils.log: add option to use dump instead of console and add timing info [r=dao, a=gavin]
This commit is contained in:
parent
d9156f1337
commit
442d8150a9
@ -466,13 +466,20 @@ Subscribable.prototype = {
|
||||
let Utils = {
|
||||
// ___ Logging
|
||||
|
||||
useConsole: true, // as opposed to dump
|
||||
showTime: false,
|
||||
|
||||
// ----------
|
||||
// Function: log
|
||||
// Prints the given arguments to the JavaScript error console as a message.
|
||||
// Pass as many arguments as you want, it'll print them all.
|
||||
log: function() {
|
||||
var text = this.expandArgumentsForLog(arguments);
|
||||
Services.console.logStringMessage(text);
|
||||
var prefix = this.showTime ? Date.now() + ': ' : '';
|
||||
if (this.useConsole)
|
||||
Services.console.logStringMessage(prefix + text);
|
||||
else
|
||||
dump(prefix + text + '\n');
|
||||
},
|
||||
|
||||
// ----------
|
||||
@ -481,7 +488,11 @@ let Utils = {
|
||||
// Pass as many arguments as you want, it'll print them all.
|
||||
error: function() {
|
||||
var text = this.expandArgumentsForLog(arguments);
|
||||
Cu.reportError("tabview error: " + text);
|
||||
var prefix = this.showTime ? Date.now() + ': ' : '';
|
||||
if (this.useConsole)
|
||||
Cu.reportError(prefix + "tabview error: " + text);
|
||||
else
|
||||
dump(prefix + "TABVIEW ERROR: " + text + '\n');
|
||||
},
|
||||
|
||||
// ----------
|
||||
|
Loading…
x
Reference in New Issue
Block a user