From 0cbb342ff4755481c64eda69f262c57ca169f51a Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 8 Dec 2013 15:34:36 +0100 Subject: [PATCH] logger_c: only append a newline if the message doesn't already end in one --- src/common/logger.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/logger.cpp b/src/common/logger.cpp index 04251d20a..e5fc66bc7 100644 --- a/src/common/logger.cpp +++ b/src/common/logger.cpp @@ -49,7 +49,9 @@ logger_c::log(std::string const &message) { char timestamp[30]; std::strftime(timestamp, 30, "%Y-%m-%d %H:%M:%S", std::localtime(&tnow)); - out.puts((boost::format("%1% +%2%ms %3%\n") % timestamp % std::chrono::duration_cast(diff).count() % message).str()); + out.puts((boost::format("%1% +%2%ms %3%") % timestamp % std::chrono::duration_cast(diff).count() % message).str()); + if (message.size() && (message[message.size() - 1] != '\n')) + out.puts("\n"); } catch (mtx::mm_io::exception &ex) { } }