summaryrefslogtreecommitdiffhomepage
path: root/log.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2025-01-04 19:40:09 +0100
committerRoland Reichwein <mail@reichwein.it>2025-01-04 19:40:09 +0100
commit770540693fd4a5f9b64c1b2bc8183be3f72ab314 (patch)
treebaa2aa113920de8f75bd7a683e238d6f80c3957a /log.cpp
parent62c74d6bd161fdab8094c37508db39ac0cc2578a (diff)
Fix log
Diffstat (limited to 'log.cpp')
-rw-r--r--log.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/log.cpp b/log.cpp
index dae56c7..a8bd7f3 100644
--- a/log.cpp
+++ b/log.cpp
@@ -41,6 +41,7 @@ log_stream& log_stream::operator<<(
void log_stream::trim_buffer()
{
std::string s = m_buffer.str();
+
size_t pos = s.npos;
for (int i = 0; i <= m_log_lines; ++i) {
pos = s.rfind("\n", pos);
@@ -54,4 +55,5 @@ void log_stream::trim_buffer()
}
m_buffer.str(s.substr((pos <= (s.size() - 2)) ? pos + 2 : pos));
+ m_buffer.seekp(0, std::ios_base::end);
}