Browse Source

Android: Call __android_log_print() in chunks to ensure that the full log is printed

tags/2021-05-28
Lukasz Kozakiewicz Tom Poole 7 years ago
parent
commit
50310edc57
1 changed files with 14 additions and 1 deletions
  1. +14
    -1
      modules/juce_core/native/juce_android_Misc.cpp

+ 14
- 1
modules/juce_core/native/juce_android_Misc.cpp View File

@@ -25,7 +25,20 @@ namespace juce
void Logger::outputDebugString (const String& text)
{
__android_log_print (ANDROID_LOG_INFO, "JUCE", "%s", text.toUTF8().getAddress());
char* data = text.toUTF8().getAddress();
const size_t length = CharPointer_UTF8::getBytesRequiredFor (text.getCharPointer());
const size_t chunkSize = 1023;
size_t position = 0;
size_t numToRead = jmin (chunkSize, length);
while (numToRead > 0)
{
__android_log_print (ANDROID_LOG_INFO, "JUCE", "%s", data + position);
position += numToRead;
numToRead = jmin (chunkSize, length - position);
}
}
} // namespace juce

Loading…
Cancel
Save