Log: trim trailing newlines

refs #7828
This commit is contained in:
Alexander A. Klimov 2020-02-19 11:27:58 +01:00
parent 099cc5d8df
commit 63a8c1b7ef
1 changed files with 8 additions and 1 deletions

View File

@ -10,6 +10,7 @@
#include "base/context.hpp"
#include "base/scriptglobal.hpp"
#include <iostream>
#include <utility>
using namespace icinga;
@ -201,7 +202,13 @@ Log::~Log()
entry.Timestamp = Utility::GetTime();
entry.Severity = m_Severity;
entry.Facility = m_Facility;
entry.Message = m_Buffer.str();
{
auto msg (m_Buffer.str());
msg.erase(msg.find_last_not_of("\n") + 1u);
entry.Message = std::move(msg);
}
if (m_Severity >= LogWarning) {
ContextTrace context;