title: Design a C++ Logger with operator '<<'
body: <p>I am designing a C++ asynchronous lightweight logger. A rough implementation would look like below,</p>
  
  <pre><code>ILogger log(fileName, LoggingLevel::WARN)
  log &lt;&lt; "Hello" &lt;&lt; "This is sample warn logging";
  </code></pre>
  
  <p>I am using concurrent queue, so I will upload all the logging messages to concurrent queue and another thread will take messages out of it and write it to a file.</p>
  
  <p>I have a problem though,</p>
  
  <p>My overloaded operator is as follows,</p>
  
  <pre><code>ILogger&amp; operator&lt;&lt; (string s)
  {
      logStr += s;
      return *this;
      // There should be a point where instead of just returning, I
      // should call queue.add(logStr);
  }
  </code></pre>
  
  <p>The problem is I don't know when to stop appending to logStr and flush the string into the concurrent queue.</p>
  
  <p>I donot want a delimiter like endLog to say the log ended. Are there any way to determine the end of "&lt;&lt;" without having a special delimiter</p>