code: function formatValue(v,depth) {
      if (depth===undefined || depth===null) {
          depth=1;
      }
      var tp=typeof(v), val;
      if (v===null) {
          return "null";
      } else if (v===undefined) {
          return "undefined";
      } else if (tp==='object') {
          if (depth>0) {
              var properties=[];
              if (v.constructor===Array) {
                  for (var i=0,sz=v.length;sz>i;i++) {
                      val=v[i];
                      if (typeof(val)==='string') {
                          properties.push(i+':"'+formatValue(val,depth-1)+'"');
                      } else {
                          properties.push(i+":"+formatValue(val,depth-1));
                      }
                  }
                  return "["+properties.join(", ")+"]";
              } else {
                  var keys=[];
                  for (var k in v) {
                      if (k.match(/^\+/)) {
                          // this is a meta-data property
                          continue;
                      }
                      keys.push(k);
                  }
                  // sort keys as IE 8 uses a different order than other browsers
                  keys.sort(lexicalSort);
  
                  for (var i=0,sz=keys.length;sz>i;i++) {
                      val=v[keys[i]];
                      if (typeof(val)==='string') {
                          properties.push(keys[i]+':"'+formatValue(val,depth-1)+'"');
                      } else {
                          properties.push(keys[i]+':'+formatValue(val,depth-1));
                      }
                  }
                  return "{"+properties.join(", ")+"}";
              }
          } else {
              if (v.constructor===Array) {
                  return "Array["+v.length+"]";
              } else if (v.constructor===Function) {
                  return "Function";
              } else {
                  return "Object";
              }
          }
      } else if (tp==='function') {
          return "Function";
      } else {
          return ''+v;
      }
  }
docs: Format a JS entity for the log
  @param v {Object} the value to format
  @param depth {Number} the formatting of objects and arrays (default: 1)