make sure glog only write to stderr using google::LogToStderr() #790
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request
Feature
FLAGS_logtostderr
works fine on desktop environments, but on Android, it does not write to logcat, and requires to have a validlog_dir
in order to write log files as well as logcat.https://github.com/google/glog/blob/b33e3bad4c46c8a6345525fd822af355e5ef9446/src/logging.cc#L809 (only
LogDestination::MaybeLogToStderr
can write to logcat on Android)https://github.com/google/glog/blob/b33e3bad4c46c8a6345525fd822af355e5ef9446/src/logging.cc#L1840 (if
FLAGS_logtostderr
is set, the branch above cannot be reached)google::LogToStderr()
makes the log only goes to stderr on desktop, and logcat on Android.https://github.com/google/glog/blob/b33e3bad4c46c8a6345525fd822af355e5ef9446/src/logging.cc#L727-L734
I only tested it on Android, maybe further testing is needed.
Unit test
Manual test
Code Review
Additional Info