X-Git-Url: https://git.r.bdr.sh/rbdr/cologne/blobdiff_plain/e16e2dbf4c0911a5d5e8d1d56bb1c674b37fc161..b39688c9e0d42361c2351a2c66068fc634cb6557:/lib/cobalt.js?ds=inline diff --git a/lib/cobalt.js b/lib/cobalt.js index 58a305c..d2d2c13 100644 --- a/lib/cobalt.js +++ b/lib/cobalt.js @@ -91,23 +91,19 @@ // Builds a Cobalt Log Object buildLog : function (item, level) { - var co = this, oldItem; + var co = this, oldItem, logObject = {}; if (!item._cobaltLog) { - if (typeof item !== "object") { - item = {message : item.toString() }; - } else { - item.message = Cobalt.stringify(item); - } - - item._cobaltLog = true; - item._from = co.from; - item._level = item._level || level || 7; - item._levelString = co._levelString(item._level); - item._version = co.version; - item._timestamp = co.now(); - item._indentLevel = co.currentIndent; - item._color = co.currentColor; + logObject.message = item; + logObject._cobaltLog = true; + logObject._from = co.from; + logObject._level = item._level || level || 7; + logObject._levelString = co._levelString(item._level); + logObject._version = co.version; + logObject._timestamp = co.now(); + logObject._indentLevel = co.currentIndent; + logObject._color = co.currentColor; + return logObject; } return item; @@ -239,7 +235,15 @@ // Returns the current time in microseconds. now : function () { - this.constructor.now(); + if (typeof performance !== 'undefined' && performance.timing) { + return performance.timing.navigationStart + performance.now(); + } + + if (typeof Microtime !== 'undefined') { + return Microtime.nowDouble() * 1000; + } + + return Date.now(); }, _levelString : function (level) {