title: How to make sure a chained logging statement is atomic?
body: <p>I have a logging class which has <code>operator&lt;&lt;</code> overloaded. So I can do things like this:</p>
  
  <pre><code>oLogger &lt;&lt; "Log this" &lt;&lt; " and this" &lt;&lt; " and " &lt;&lt; 10 &lt;&lt; endl;
  oLogger`&lt;&lt; "Something else" &lt;&lt; endl;
  </code></pre>
  
  <p>The logger does this without any problems. But, I want the logger object to be shared among threads. Then, I don't want it printing out something like this:</p>
  
  <pre><code>//LogFILE
  Log this and this Something else
   and 10
  </code></pre>
  
  <p>So, I need to lock a whole chain of <code>operator&lt;&lt;</code>s. I am guessing this can be done with RAII, I haven't given it much thought yet. In the meantime, is there any traditional way of getting this done? (Except ending input with a manipulator?)</p>