Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mlfarrell/940c8768118dac7d98b742916e3e881f to your computer and use it in GitHub Desktop.
Save mlfarrell/940c8768118dac7d98b742916e3e881f to your computer and use it in GitHub Desktop.
int Logger::Buffer::flushBuffer()
{
int num = (int)(pptr()-pbase());
/*if(cout.write(buffer, num) != num)
{
return EOF;
}*/
#if (defined WIN10_BUILD) || (defined WIN32)
static char buf[4096];
memcpy(buf, buffer, num);
buf[num] = 0;
OutputDebugStringA(buf);
#elif defined ANDROID
static char buf[4096];
memcpy(buf, buffer, num);
buf[num] = 0;
__android_log_print(ANDROID_LOG_INFO, "VGLPP", "%s", buf);
#endif
#ifdef STDOUT_LOGGING
cout.write(buffer, num);
#else
loggerParent.log.write(buffer, num);
loggerParent.log << std::flush;
#endif
pbump(-num); // reset put pointer accordingly
return num;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment