2019-09-30 19:18:09 +02:00
|
|
|
diff --git a/src/logging.cc b/src/logging.cc
|
2023-07-27 00:18:20 +02:00
|
|
|
index 4028ccc..483e639 100644
|
2019-09-30 19:18:09 +02:00
|
|
|
--- a/src/logging.cc
|
|
|
|
+++ b/src/logging.cc
|
2023-07-27 00:18:20 +02:00
|
|
|
@@ -1743,6 +1743,23 @@ ostream& LogMessage::stream() {
|
2019-09-30 19:18:09 +02:00
|
|
|
return data_->stream_;
|
|
|
|
}
|
|
|
|
|
|
|
|
+namespace {
|
|
|
|
+#if defined(__ANDROID__)
|
|
|
|
+int AndroidLogLevel(const int severity) {
|
|
|
|
+ switch (severity) {
|
|
|
|
+ case 3:
|
|
|
|
+ return ANDROID_LOG_FATAL;
|
|
|
|
+ case 2:
|
|
|
|
+ return ANDROID_LOG_ERROR;
|
|
|
|
+ case 1:
|
|
|
|
+ return ANDROID_LOG_WARN;
|
|
|
|
+ default:
|
|
|
|
+ return ANDROID_LOG_INFO;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+#endif // defined(__ANDROID__)
|
|
|
|
+} // namespace
|
|
|
|
+
|
|
|
|
// Flush buffered message, called by the destructor, or any other function
|
|
|
|
// that needs to synchronize the log.
|
|
|
|
void LogMessage::Flush() {
|
2023-07-27 00:18:20 +02:00
|
|
|
@@ -1779,6 +1796,12 @@ void LogMessage::Flush() {
|
2019-09-30 19:18:09 +02:00
|
|
|
}
|
|
|
|
LogDestination::WaitForSinks(data_);
|
|
|
|
|
|
|
|
+#if defined(__ANDROID__)
|
|
|
|
+ const int level = AndroidLogLevel((int)data_->severity_);
|
|
|
|
+ const std::string text = std::string(data_->message_text_);
|
|
|
|
+ __android_log_write(level, "native", text.substr(0,data_->num_chars_to_log_).c_str());
|
2021-05-05 03:30:15 +02:00
|
|
|
+#endif // defined(__ANDROID__)
|
2019-09-30 19:18:09 +02:00
|
|
|
+
|
|
|
|
if (append_newline) {
|
|
|
|
// Fix the ostrstream back how it was before we screwed with it.
|
2021-05-05 03:30:15 +02:00
|
|
|
// It's 99.44% certain that we don't need to worry about doing this.
|
2023-07-27 21:04:50 +02:00
|
|
|
|
|
|
|
diff --git a/bazel/glog.bzl b/bazel/glog.bzl
|
|
|
|
index dacd934..62d2a88 100644
|
|
|
|
--- a/bazel/glog.bzl
|
|
|
|
+++ b/bazel/glog.bzl
|
|
|
|
@@ -53,7 +53,7 @@ def glog_library(namespace = "google", with_gflags = 1, **kwargs):
|
|
|
|
)
|
|
|
|
|
|
|
|
common_copts = [
|
|
|
|
- "-std=c++14",
|
|
|
|
+ "-std=c++17",
|
|
|
|
"-DGLOG_BAZEL_BUILD",
|
|
|
|
# Inject a C++ namespace.
|
|
|
|
"-DGOOGLE_NAMESPACE='%s'" % namespace,
|