Index: net/cronet/android/android_log.h |
diff --git a/net/cronet/android/android_log.h b/net/cronet/android/android_log.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ff05823b73dad8fb5a115cd7cb4cb00668de8a9e |
--- /dev/null |
+++ b/net/cronet/android/android_log.h |
@@ -0,0 +1,37 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef NET_CRONET_ANDROID_ANDROID_LOG_H_ |
+#define NET_CRONET_ANDROID_ANDROID_LOG_H_ |
+ |
+#include <android/log.h> |
+ |
+// Specifies the granularity of events that should be logged. |
+enum LoggingLevel { |
+ // Don't log anything |
+ LOG_NONE = 0, |
+ |
+ // Log major events useful for debugging |
+ LOG_DEBUG, |
+ |
+ // Log everything |
+ LOG_VERBOSE, |
+}; |
+ |
+#define LOGD(tag, log_level, ...) \ |
+ if ((log_level) == LOG_DEBUG || (log_level) == LOG_VERBOSE) \ |
+ __android_log_print(ANDROID_LOG_DEBUG, (tag), __VA_ARGS__) |
+ |
+#define LOGV(tag, log_level, ...) \ |
+ if ((log_level) == LOG_VERBOSE) \ |
+ __android_log_print(ANDROID_LOG_VERBOSE, (tag), __VA_ARGS__) |
+ |
+#define LOGE(tag, ...) \ |
+ __android_log_print(ANDROID_LOG_ERROR, (tag), __VA_ARGS__) |
+ |
+#define ASSERT(tag, condition) \ |
+ if (!(condition)) \ |
+ __android_log_assert(#condition, tag, "Assert failed: " #condition) |
+ |
+#endif // NET_CRONET_ANDROID_ANDROID_LOG_H_ |