We've refactored our logger to use boost instead of our in-house logger which is not thread-safe. The problem is that all of our log calls around the project (thousands of lines of code) are ending with std::endl
. Now, our logger is thread safe but there is an extra empty line between records on the output.
This is how I initialize the logger:
void init()
{
boost::log::add_console_log
(
std::clog,
boost::log::keywords::format =
(
boost::log::expressions::stream << boost::log::expressions::format_date_time< boost::posix_time::ptime >("TimeStamp", "%Y-%m-%d %H:%M:%S")
<< " [" << boost::log::expressions::attr< LogLevel_e >("Severity") << "]: "
<< boost::log::expressions::smessage
)
);
}
It's a severity_logger_mt() object that is used to log our messages. I've read in their documentation that I might be able to prevent that empty line from happening if I create my own backend and frontend. It seems like too much of a hassle to create two modules just to prevent one extra empty line in the code.
Am I missing anything? is there an easier way to do it? Should I add more information to this question? Also, we're talking about boost 1.69.