summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--UI.cpp1
-rw-r--r--log.cpp2
2 files changed, 3 insertions, 0 deletions
diff --git a/UI.cpp b/UI.cpp
index 933f2de..9bf6632 100644
--- a/UI.cpp
+++ b/UI.cpp
@@ -171,6 +171,7 @@ void UI::draw()
std::cout << fmt::format(" Main loops/s: {}", main_loops_per_second) << std::endl;
+ std::cout << std::endl;
std::cout << "Log:" << std::endl;
std::cout << log_cout.get_log() << std::endl;
}
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);
}