]> git.r.bdr.sh - rbdr/cologne/blobdiff - lib/cobalt.js
Uses global.io if no socket is provided
[rbdr/cologne] / lib / cobalt.js
index 981aab21b24c310d8f1cb161430233fefb5d7b51..d2d2c13c7fd37b79dc2e4fe4f6299b24f962c779 100644 (file)
 
       // 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;
 
       // Returns the current time in microseconds.
       now : function () {
-        if (typeof performance !== 'undefined') {
+        if (typeof performance !== 'undefined' && performance.timing) {
           return performance.timing.navigationStart + performance.now();
         }