1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 21:45:35 +00:00

Merge branch 'osg_log' into 'master'

Split long osg log messages into lines.

See merge request OpenMW/openmw!519
This commit is contained in:
AnyOldName3 2021-01-09 01:05:53 +00:00
commit 2d61db555b

View file

@ -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);
}
}
}
};
}