Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: third_party/protobuf/src/google/protobuf/stubs/common.cc

Issue 2599263002: third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Address comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/src/google/protobuf/stubs/common.cc
diff --git a/third_party/protobuf/src/google/protobuf/stubs/common.cc b/third_party/protobuf/src/google/protobuf/stubs/common.cc
index 54dbafab5dcaca22cc2658a1682b5ef553dff595..146559164fe5091991c258324eadec6339457790 100644
--- a/third_party/protobuf/src/google/protobuf/stubs/common.cc
+++ b/third_party/protobuf/src/google/protobuf/stubs/common.cc
@@ -108,11 +108,17 @@ string VersionString(int version) {
// ===================================================================
// emulates google3/base/logging.cc
+// If the minimum logging level is not set, we default to logging messages for
+// all levels.
+#ifndef GOOGLE_PROTOBUF_MIN_LOG_LEVEL
+#define GOOGLE_PROTOBUF_MIN_LOG_LEVEL LOGLEVEL_INFO
+#endif
+
namespace internal {
+
#if defined(__ANDROID__)
inline void DefaultLogHandler(LogLevel level, const char* filename, int line,
const string& message) {
-#ifdef GOOGLE_PROTOBUF_MIN_LOG_LEVEL
if (level < GOOGLE_PROTOBUF_MIN_LOG_LEVEL) {
return;
}
@@ -143,11 +149,14 @@ inline void DefaultLogHandler(LogLevel level, const char* filename, int line,
__android_log_write(ANDROID_LOG_FATAL, "libprotobuf-native",
"terminating.\n");
}
-#endif
}
+
#else
void DefaultLogHandler(LogLevel level, const char* filename, int line,
const string& message) {
+ if (level < GOOGLE_PROTOBUF_MIN_LOG_LEVEL) {
+ return;
+ }
static const char* level_names[] = { "INFO", "WARNING", "ERROR", "FATAL" };
// We use fprintf() instead of cerr because we want this to work at static

Powered by Google App Engine
This is Rietveld 408576698