зеркало из https://github.com/mozilla/pluotsorbet.git
Make console work before the VM is initialized.
This commit is contained in:
Родитель
dfbfcb893f
Коммит
7b22da7f34
|
@ -45,19 +45,31 @@
|
|||
}
|
||||
|
||||
this.levelName = levelName;
|
||||
this.ctx = $ ? $.ctx : null;
|
||||
this.ctx = typeof $ !== "undefined" && $ ? $.ctx : null;
|
||||
this.logLevel = LOG_LEVELS[levelName];
|
||||
this.args = args;
|
||||
this.time = performance.now() - startTime;
|
||||
}
|
||||
|
||||
function padRight(str, c, n) {
|
||||
var length = str.length;
|
||||
if (!c || length >= n) {
|
||||
return str;
|
||||
}
|
||||
var max = (n - length) / c.length;
|
||||
for (var i = 0; i < max; i++) {
|
||||
str += c;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
LogItem.prototype = {
|
||||
get messagePrefix() {
|
||||
var s = J2ME.Context.currentContextPrefix();
|
||||
var s = typeof J2ME !== "undefined" ? J2ME.Context.currentContextPrefix() : "";
|
||||
if (false) {
|
||||
s = this.time.toFixed(2) + " " + s;
|
||||
}
|
||||
return s.toString().padRight(" ", 4) + " | ";
|
||||
return padRight(s.toString(), " ", 4) + " | ";
|
||||
},
|
||||
|
||||
get message() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче