Break up long log messages on Android as they are cut otherwise.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5503 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2017-07-16 14:55:14 +00:00
parent 80718d0e60
commit 2117249df1
1 changed files with 11 additions and 1 deletions

View File

@ -173,7 +173,17 @@ namespace os
break;
}
__android_log_print(LogLevel, "Irrlicht", "%s\n", message);
// Android logcat restricts log-output and cuts the rest of the message away. But we want it all.
// On my device max-len is 1023 (+ 0 byte). Some websites claim a limit of 4096 so maybe different numbers on different devices.
const size_t maxLogLen = 1023;
size_t msgLen = strlen(message);
size_t start = 0;
while ( msgLen-start > maxLogLen )
{
__android_log_print(LogLevel, "Irrlicht", "%.*s\n", maxLogLen, &message[start]);
start += maxLogLen;
}
__android_log_print(LogLevel, "Irrlicht", "%s\n", &message[start]);
}
void Timer::initTimer(bool usePerformanceTimer)