summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-09-21 15:22:00 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-21 15:22:00 -0700
commit41fd0a0fa98adf06cad78d168f3e5fe4ab272ea4 (patch)
tree2181adef969dcf0da0e57a75c6e41b5f2e43fd5f /include
parentd68e8d679c199d1cbef314e8bd545bcb62e36a88 (diff)
parentaf90958184fc5cfa1a4190e28bcfc4fdd4a5bcd6 (diff)
downloadframeworks_base-41fd0a0fa98adf06cad78d168f3e5fe4ab272ea4.zip
frameworks_base-41fd0a0fa98adf06cad78d168f3e5fe4ab272ea4.tar.gz
frameworks_base-41fd0a0fa98adf06cad78d168f3e5fe4ab272ea4.tar.bz2
am af909581: am 67738486: Merge "Remove stagefright foundation\'s incompatible logging interface and update callsites." into gingerbread
Merge commit 'af90958184fc5cfa1a4190e28bcfc4fdd4a5bcd6' * commit 'af90958184fc5cfa1a4190e28bcfc4fdd4a5bcd6': Remove stagefright foundation's incompatible logging interface and update callsites.
Diffstat (limited to 'include')
-rw-r--r--include/media/stagefright/foundation/ADebug.h49
1 files changed, 12 insertions, 37 deletions
diff --git a/include/media/stagefright/foundation/ADebug.h b/include/media/stagefright/foundation/ADebug.h
index 0f986a0..69021d8 100644
--- a/include/media/stagefright/foundation/ADebug.h
+++ b/include/media/stagefright/foundation/ADebug.h
@@ -22,45 +22,18 @@
#include <media/stagefright/foundation/ABase.h>
#include <media/stagefright/foundation/AString.h>
+#include <utils/Log.h>
namespace android {
-enum LogType {
- VERBOSE,
- INFO,
- WARNING,
- ERROR,
- FATAL,
-};
-
-struct Logger {
- Logger(LogType type);
- virtual ~Logger();
-
- template<class T> Logger &operator<<(const T &x) {
- mMessage.append(x);
-
- return *this;
- }
-
-private:
- android::AString mMessage;
- LogType mLogType;
-
- DISALLOW_EVIL_CONSTRUCTORS(Logger);
-};
-
-const char *LeafName(const char *s);
-
-#undef LOG
-#define LOG(type) Logger(type) << LeafName(__FILE__) << ":" << __LINE__ << " "
+#define LITERAL_TO_STRING_INTERNAL(x) #x
+#define LITERAL_TO_STRING(x) LITERAL_TO_STRING_INTERNAL(x)
#define CHECK(condition) \
- do { \
- if (!(condition)) { \
- LOG(FATAL) << "CHECK(" #condition ") failed."; \
- } \
- } while (false)
+ LOG_ALWAYS_FATAL_IF( \
+ !(condition), \
+ __FILE__ ":" LITERAL_TO_STRING(__LINE__) \
+ " CHECK(" #condition ") failed.")
#define MAKE_COMPARATOR(suffix,op) \
template<class A, class B> \
@@ -85,8 +58,10 @@ MAKE_COMPARATOR(GT,>)
do { \
AString ___res = Compare_##suffix(x, y); \
if (!___res.empty()) { \
- LOG(FATAL) << "CHECK_" #suffix "(" #x "," #y ") failed: " \
- << ___res; \
+ LOG_ALWAYS_FATAL( \
+ __FILE__ ":" LITERAL_TO_STRING(__LINE__) \
+ " CHECK_" #suffix "( " #x "," #y ") failed: %s", \
+ ___res.c_str()); \
} \
} while (false)
@@ -97,7 +72,7 @@ MAKE_COMPARATOR(GT,>)
#define CHECK_GE(x,y) CHECK_OP(x,y,GE,>=)
#define CHECK_GT(x,y) CHECK_OP(x,y,GT,>)
-#define TRESPASS() LOG(FATAL) << "Should not be here."
+#define TRESPASS() LOG_ALWAYS_FATAL("Should not be here.")
} // namespace android