title: How to easily make std::cout thread-safe?
body: <p>I have a multi-threaded application, which heavily uses <code>std::cout</code> for logging without any locking. In such a case, how can I easily add lock mechanism to make <code>std::cout</code> thread-safe?</p>
  
  <p>I don't want to search for each occurrence of <code>std::cout</code> and add a line of locking code. That is too tedious.</p>
  
  <p>Any better practice?</p>