OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_CRONET_ANDROID_ANDROID_LOG_H_ |
| 6 #define NET_CRONET_ANDROID_ANDROID_LOG_H_ |
| 7 |
| 8 #include <android/log.h> |
| 9 |
| 10 // Specifies the granularity of events that should be logged. |
| 11 enum LoggingLevel { |
| 12 // Don't log anything |
| 13 LOG_NONE = 0, |
| 14 |
| 15 // Log major events useful for debugging |
| 16 LOG_DEBUG, |
| 17 |
| 18 // Log everything |
| 19 LOG_VERBOSE, |
| 20 }; |
| 21 |
| 22 #define LOGD(tag, log_level, ...) \ |
| 23 if ((log_level) == LOG_DEBUG || (log_level) == LOG_VERBOSE) \ |
| 24 __android_log_print(ANDROID_LOG_DEBUG, (tag), __VA_ARGS__) |
| 25 |
| 26 #define LOGV(tag, log_level, ...) \ |
| 27 if ((log_level) == LOG_VERBOSE) \ |
| 28 __android_log_print(ANDROID_LOG_VERBOSE, (tag), __VA_ARGS__) |
| 29 |
| 30 #define LOGE(tag, ...) \ |
| 31 __android_log_print(ANDROID_LOG_ERROR, (tag), __VA_ARGS__) |
| 32 |
| 33 #define ASSERT(tag, condition) \ |
| 34 if (!(condition)) \ |
| 35 __android_log_assert(#condition, tag, "Assert failed: " #condition) |
| 36 |
| 37 #endif // NET_CRONET_ANDROID_ANDROID_LOG_H_ |
OLD | NEW |