-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make AndroidLogStreamBuffer print to console aswell #98
Conversation
Codecov Report
@@ Coverage Diff @@
## master #98 +/- ##
=======================================
Coverage 97.64% 97.64%
=======================================
Files 98 98
Lines 7012 7012
=======================================
Hits 6847 6847
Misses 165 165 Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm not sure about the use case here -- usually what I have is either a console application, running in a shell (and then I don't need it to fill the android log because I see the output right away), or I have an APK, which doesn't make sense to be run from a shell anyway, and thus filling cout is wasteful as well.
Unless I missed something, it doesn't look to me like a single app would need both at the same time -- and if it can operate in both contexts, I could imagine it only opting-in to AndroidLogStreamBuffer if it's not run from a shell.
Furthermore, this doesn't really need a change to this class itself. It could easily be done in a subclass that overrides the sync()
and then prints to both -- so this means you could easily make a subclass inside your particular poject that has such special needs.
const char * tag = _tag.data(); | ||
const char * data = str().data(); | ||
__android_log_write(std::int32_t(_priority), tag, data); | ||
std::cout << data; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes all output to be put into std::cout
, with no chance of distincting between stdout or stderr. I'm not sure I like that. Make this configurable? Or choose it based on _priority
?
Also, what about flushing? Usually when you have error or assertion messages, you'd want them to be printed right away and not in some buffer that might not get emptied before the application crashes / aborts.
hmmm ok |
how about this? |
this is useful when executing native executables via a shell