Merge "A wee little division by 8 makes all the difference."
diff --git a/include/cutils/log.h b/include/cutils/log.h
index 42d7382..93c01e0 100644
--- a/include/cutils/log.h
+++ b/include/cutils/log.h
@@ -77,7 +77,7 @@
#if LOG_NDEBUG
#define LOGV(...) ((void)0)
#else
-#define LOGV(...) ((void)LOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
+#define LOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
#endif
#endif
@@ -89,7 +89,7 @@
#else
#define LOGV_IF(cond, ...) \
( (CONDITION(cond)) \
- ? ((void)LOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
+ ? ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
: (void)0 )
#endif
#endif
@@ -98,13 +98,13 @@
* Simplified macro to send a debug log message using the current LOG_TAG.
*/
#ifndef LOGD
-#define LOGD(...) ((void)LOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
+#define LOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
#endif
#ifndef LOGD_IF
#define LOGD_IF(cond, ...) \
( (CONDITION(cond)) \
- ? ((void)LOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
+ ? ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
: (void)0 )
#endif
@@ -112,13 +112,13 @@
* Simplified macro to send an info log message using the current LOG_TAG.
*/
#ifndef LOGI
-#define LOGI(...) ((void)LOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
+#define LOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
#endif
#ifndef LOGI_IF
#define LOGI_IF(cond, ...) \
( (CONDITION(cond)) \
- ? ((void)LOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \
+ ? ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \
: (void)0 )
#endif
@@ -126,13 +126,13 @@
* Simplified macro to send a warning log message using the current LOG_TAG.
*/
#ifndef LOGW
-#define LOGW(...) ((void)LOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
+#define LOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
#endif
#ifndef LOGW_IF
#define LOGW_IF(cond, ...) \
( (CONDITION(cond)) \
- ? ((void)LOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \
+ ? ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \
: (void)0 )
#endif
@@ -140,13 +140,13 @@
* Simplified macro to send an error log message using the current LOG_TAG.
*/
#ifndef LOGE
-#define LOGE(...) ((void)LOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
+#define LOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
#endif
#ifndef LOGE_IF
#define LOGE_IF(cond, ...) \
( (CONDITION(cond)) \
- ? ((void)LOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
+ ? ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
: (void)0 )
#endif
@@ -160,7 +160,7 @@
#if LOG_NDEBUG
#define IF_LOGV() if (false)
#else
-#define IF_LOGV() IF_LOG(LOG_VERBOSE, LOG_TAG)
+#define IF_LOGV() IF_ALOG(LOG_VERBOSE, LOG_TAG)
#endif
#endif
@@ -169,7 +169,7 @@
* debug priority.
*/
#ifndef IF_LOGD
-#define IF_LOGD() IF_LOG(LOG_DEBUG, LOG_TAG)
+#define IF_LOGD() IF_ALOG(LOG_DEBUG, LOG_TAG)
#endif
/*
@@ -177,7 +177,7 @@
* info priority.
*/
#ifndef IF_LOGI
-#define IF_LOGI() IF_LOG(LOG_INFO, LOG_TAG)
+#define IF_LOGI() IF_ALOG(LOG_INFO, LOG_TAG)
#endif
/*
@@ -185,7 +185,7 @@
* warn priority.
*/
#ifndef IF_LOGW
-#define IF_LOGW() IF_LOG(LOG_WARN, LOG_TAG)
+#define IF_LOGW() IF_ALOG(LOG_WARN, LOG_TAG)
#endif
/*
@@ -193,7 +193,7 @@
* error priority.
*/
#ifndef IF_LOGE
-#define IF_LOGE() IF_LOG(LOG_ERROR, LOG_TAG)
+#define IF_LOGE() IF_ALOG(LOG_ERROR, LOG_TAG)
#endif
@@ -340,12 +340,12 @@
* Basic log message macro.
*
* Example:
- * LOG(LOG_WARN, NULL, "Failed with error %d", errno);
+ * ALOG(LOG_WARN, NULL, "Failed with error %d", errno);
*
* The second argument may be NULL or "" to indicate the "global" tag.
*/
-#ifndef LOG
-#define LOG(priority, tag, ...) \
+#ifndef ALOG
+#define ALOG(priority, tag, ...) \
LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
#endif
@@ -368,8 +368,8 @@
/*
* Conditional given a desired logging priority and tag.
*/
-#ifndef IF_LOG
-#define IF_LOG(priority, tag) \
+#ifndef IF_ALOG
+#define IF_ALOG(priority, tag) \
if (android_testLog(ANDROID_##priority, tag))
#endif
diff --git a/logwrapper/logwrapper.c b/logwrapper/logwrapper.c
index bdf53e8..6a80560 100644
--- a/logwrapper/logwrapper.c
+++ b/logwrapper/logwrapper.c
@@ -28,7 +28,7 @@
void fatal(const char *msg) {
fprintf(stderr, "%s", msg);
- LOG(LOG_ERROR, "logwrapper", "%s", msg);
+ ALOG(LOG_ERROR, "logwrapper", "%s", msg);
exit(-1);
}
@@ -60,7 +60,7 @@
buffer[b] = '\0';
} else if (buffer[b] == '\n') {
buffer[b] = '\0';
- LOG(LOG_INFO, tag, "%s", &buffer[a]);
+ ALOG(LOG_INFO, tag, "%s", &buffer[a]);
a = b + 1;
}
}
@@ -68,7 +68,7 @@
if (a == 0 && b == sizeof(buffer) - 1) {
// buffer is full, flush
buffer[b] = '\0';
- LOG(LOG_INFO, tag, "%s", &buffer[a]);
+ ALOG(LOG_INFO, tag, "%s", &buffer[a]);
b = 0;
} else if (a != b) {
// Keep left-overs
@@ -84,21 +84,21 @@
// Flush remaining data
if (a != b) {
buffer[b] = '\0';
- LOG(LOG_INFO, tag, "%s", &buffer[a]);
+ ALOG(LOG_INFO, tag, "%s", &buffer[a]);
}
status = 0xAAAA;
if (wait(&status) != -1) { // Wait for child
if (WIFEXITED(status))
- LOG(LOG_INFO, "logwrapper", "%s terminated by exit(%d)", tag,
+ ALOG(LOG_INFO, "logwrapper", "%s terminated by exit(%d)", tag,
WEXITSTATUS(status));
else if (WIFSIGNALED(status))
- LOG(LOG_INFO, "logwrapper", "%s terminated by signal %d", tag,
+ ALOG(LOG_INFO, "logwrapper", "%s terminated by signal %d", tag,
WTERMSIG(status));
else if (WIFSTOPPED(status))
- LOG(LOG_INFO, "logwrapper", "%s stopped by signal %d", tag,
+ ALOG(LOG_INFO, "logwrapper", "%s stopped by signal %d", tag,
WSTOPSIG(status));
} else
- LOG(LOG_INFO, "logwrapper", "%s wait() failed: %s (%d)", tag,
+ ALOG(LOG_INFO, "logwrapper", "%s wait() failed: %s (%d)", tag,
strerror(errno), errno);
if (seg_fault_on_exit)
*(int *)status = 0; // causes SIGSEGV with fault_address = status
@@ -111,7 +111,7 @@
argv_child[argc] = NULL;
if (execvp(argv_child[0], argv_child)) {
- LOG(LOG_ERROR, "logwrapper",
+ ALOG(LOG_ERROR, "logwrapper",
"executing %s failed: %s\n", argv_child[0], strerror(errno));
exit(-1);
}