1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 21:00:23 +01: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 {
if (settings.logLevel >= level){
var pre = "";
if (prefix){
args.unshift(prefix + ":");
pre = prefix + ": ";
}
args.unshift(
"[" +
pre += "[" +
date.getFullYear() + "-" +
leftPad(date.getMonth() + 1, "0", 2) + "-" +
leftPad(date.getDate(), "0", 2) + " " +
@ -48,7 +48,12 @@
leftPad(date.getSeconds(), "0", 2) + "." +
leftPad(date.getMilliseconds(), "0", 3) +
"]"
);
if (typeof args[0] === "string"){
args[0] = pre + " " + args[0];
}
else {
args.unshift(pre);
}
console.log.apply(console, args);
}
}