void output_ostream(std::ostream& ostr, log_level level, const std::string& domain, const std::string& body) { ostr << level_repr(level); if (!domain.empty()) ostr << " [" << domain << "]"; ostr << ": " << body << std::endl; }
static void output_ostream(std::ostream& out, log_level level, const std::string& domain, const std::string& body) { std::ostringstream buffer; buffer << level_repr(level); if (!domain.empty()) buffer << " [" << domain << "]"; buffer << ": " << body << std::endl; // Buffering prevents line interleaving across threads. out << buffer.str(); out.flush(); }