From 7d551b0cfde472da8acb7e8a8f1a0b1899694ad9 Mon Sep 17 00:00:00 2001 From: Petr Mikheev Date: Fri, 8 Jan 2021 23:21:39 +0100 Subject: [PATCH] Split long osg log messages into lines. --- apps/openmw/main.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index 89aa2b9fd5..8eaac36e81 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -254,7 +254,19 @@ namespace level = Debug::Debug; } std::string_view s(msgCopy); - Log(level) << (s.back() == '\n' ? s.substr(0, s.size() - 1) : s); + if (s.size() < 1024) + Log(level) << (s.back() == '\n' ? s.substr(0, s.size() - 1) : s); + else + { + while (!s.empty()) + { + size_t lineSize = 1; + while (lineSize < s.size() && s[lineSize - 1] != '\n') + lineSize++; + Log(level) << s.substr(0, s[lineSize - 1] == '\n' ? lineSize - 1 : lineSize); + s = s.substr(lineSize); + } + } } }; }