title: Unique ID or object signature
body: <p>I am working on a Logging system, and am looking forward to implement a <em>log once</em> method.</p>
  <p>What I'm stuck with, is, how would I retrieve unique identifier and/or objects signature, to be used as a hash key?</p>
  <p>My idea is:</p>
  <pre><code>var Log = {
      messages : {},
      once : function(message)
      {
          // get unique id and/or passed objects signature, use it as a key
          var key = unique( message );
  
          if ( !Log.messages.hasOwnProperty(key) )
          {
              Log.messages[key] = message;
          }
      }
  };
  </code></pre>
  <p>I tried <code>.toString()</code>, but it did return simply <code>[object Object]</code> for a basic object, and <code>[object &lt;type&gt;]</code> for anything else. No ids, no nothing.</p>
  <p>I also tried the <code>toSource()</code> function, but in Chrome it did not want to work with basic objects.</p>
  <p>What I need, though, is for this to work with every type of object. Be it string, be it integer, be it function, I need to get that signature / id.</p>
  <p>Maybe there is an implemention of such function somewhere around already?</p>
  <h2>Update</h2>
  <p>This is meant to do logging in a loop, but instead of logging on each iteration, log only once in order to prevent console pollution.</p>
  <p>My particular loop is actually a game loop, and I am looking to debug some info.</p>
  <p>Like:</p>
  <pre><code>for (var i = 0; i &lt; 100; i++)
  {
      console.log('message');
  }
  // this would log 100 entries
  </code></pre>
  <p>Where:</p>
  <pre><code>for (var i = 0; i &lt; 100; i++)
  {
      Log.once('message');
  }
  // would execute behind the scenes console.log() only once.
  </code></pre>