1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-04-18 08:08:28 +02:00

Fixed logging to be able to use %s in the first logged argument.

This commit is contained in:
kkapsner 2017-09-29 00:29:34 +02:00
parent 991690091a
commit 1689686935

View File

@ -35,11 +35,11 @@
} }
else { else {
if (settings.logLevel >= level){ if (settings.logLevel >= level){
var pre = "";
if (prefix){ if (prefix){
args.unshift(prefix + ":"); pre = prefix + ": ";
} }
args.unshift( pre += "[" +
"[" +
date.getFullYear() + "-" + date.getFullYear() + "-" +
leftPad(date.getMonth() + 1, "0", 2) + "-" + leftPad(date.getMonth() + 1, "0", 2) + "-" +
leftPad(date.getDate(), "0", 2) + " " + leftPad(date.getDate(), "0", 2) + " " +
@ -48,7 +48,12 @@
leftPad(date.getSeconds(), "0", 2) + "." + leftPad(date.getSeconds(), "0", 2) + "." +
leftPad(date.getMilliseconds(), "0", 3) + leftPad(date.getMilliseconds(), "0", 3) +
"]" "]"
); if (typeof args[0] === "string"){
args[0] = pre + " " + args[0];
}
else {
args.unshift(pre);
}
console.log.apply(console, args); console.log.apply(console, args);
} }
} }