title: Call console.log with apply
body: <p>I'm trying to create a logging proxy where each log statement has a prefix.</p>
  
  <p>What I want is to do:</p>
  
  <pre><code>customDebug("xxx","yyy");
  </code></pre>
  
  <p>and under the wood it will do:</p>
  
  <pre><code>console.debug("prefix","xxx","yyy");
  </code></pre>
  
  <p>I've tried to implement it this way:</p>
  
  <pre><code>prefixLogArguments: function(arg) {
      var array = _.toArray(arg);
      array.unshift( this.getPrefix() );
      return array;
  },
  
  customDebug: function() {
      var argArray = this.prefixLogArguments(arguments);
      console.debug.apply(undefined, argArray );
  },
  </code></pre>
  
  <p>It says <code>Uncaught TypeError: Illegal invocation</code>  because it seems we can't invoke native code with <code>apply/call</code>, even with an undefined context.</p>
  
  <p>Can someone tell me how to achieve this? </p>
  
  <p>I can do <code>console.debug(argArray);</code> it's not so bad but it does not produce the same result as it logs an array instead of logging an argument list.</p>