diff --git a/lib/logging.js b/lib/logging.js index 2f918f0..70e4df3 100644 --- a/lib/logging.js +++ b/lib/logging.js @@ -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); } }