title: How to create functions like std::cout?
body: <p>I'm creating my own logging utility for my project, I want to create a function like iostream's std::cout, to log to a file and print to the console as well.</p>
  
  <p>Here's what i want:</p>
  
  <pre><code>enum
  {
      debug, error, warning, info
  };
  
  LOG(level) &lt;&lt; "test"; // level - from the above enum
  </code></pre>
  
  <p>The result should be like this:</p>
  
  <pre><code>int iPlayerID = 1337;
  LOG(info) &lt;&lt; "Player " &lt;&lt; iPlayerID &lt;&lt; "Connected";
  </code></pre>
  
  <p><code>[Thu Jan 29 18:32:11 2015] [info] Player 1337 Connected</code></p>