summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-09-21 15:17:42 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-09-21 15:17:42 -0700
commit4d6205a5ceb3e53cdcbf4f473e7bb1509503c1c5 (patch)
treed49e1542fdd694cc4965662cd2b4799de0526ee4 /include
parentee7797e08ca6cdcc1a4d3663f83946a11287ab74 (diff)
parent43d4f743a9990cebc999d670ffb5a06133b80a54 (diff)
downloadframeworks_av-4d6205a5ceb3e53cdcbf4f473e7bb1509503c1c5.zip
frameworks_av-4d6205a5ceb3e53cdcbf4f473e7bb1509503c1c5.tar.gz
frameworks_av-4d6205a5ceb3e53cdcbf4f473e7bb1509503c1c5.tar.bz2
am 67738486: Merge "Remove stagefright foundation\'s incompatible logging interface and update callsites." into gingerbread
Merge commit '67738486d9d1bdc2e6fb0c04698fd74de689acbc' into gingerbread-plus-aosp * commit '67738486d9d1bdc2e6fb0c04698fd74de689acbc': 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