Loading include/cutils/log.h +20 −20 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ extern "C" { #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 Loading @@ -89,7 +89,7 @@ extern "C" { #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 Loading @@ -98,13 +98,13 @@ extern "C" { * 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 Loading @@ -112,13 +112,13 @@ extern "C" { * 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 Loading @@ -126,13 +126,13 @@ extern "C" { * 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 Loading @@ -140,13 +140,13 @@ extern "C" { * 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 Loading @@ -160,7 +160,7 @@ extern "C" { #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 Loading @@ -169,7 +169,7 @@ extern "C" { * debug priority. */ #ifndef IF_LOGD #define IF_LOGD() IF_LOG(LOG_DEBUG, LOG_TAG) #define IF_LOGD() IF_ALOG(LOG_DEBUG, LOG_TAG) #endif /* Loading @@ -177,7 +177,7 @@ extern "C" { * info priority. */ #ifndef IF_LOGI #define IF_LOGI() IF_LOG(LOG_INFO, LOG_TAG) #define IF_LOGI() IF_ALOG(LOG_INFO, LOG_TAG) #endif /* Loading @@ -185,7 +185,7 @@ extern "C" { * warn priority. */ #ifndef IF_LOGW #define IF_LOGW() IF_LOG(LOG_WARN, LOG_TAG) #define IF_LOGW() IF_ALOG(LOG_WARN, LOG_TAG) #endif /* Loading @@ -193,7 +193,7 @@ extern "C" { * error priority. */ #ifndef IF_LOGE #define IF_LOGE() IF_LOG(LOG_ERROR, LOG_TAG) #define IF_LOGE() IF_ALOG(LOG_ERROR, LOG_TAG) #endif Loading Loading @@ -340,12 +340,12 @@ extern "C" { * 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 Loading @@ -368,8 +368,8 @@ extern "C" { /* * 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 Loading logwrapper/logwrapper.c +9 −9 Original line number Diff line number Diff line Loading @@ -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); } Loading Loading @@ -60,7 +60,7 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) { 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; } } Loading @@ -68,7 +68,7 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) { 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 Loading @@ -84,21 +84,21 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) { // 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 Loading @@ -111,7 +111,7 @@ void child(int argc, char* argv[]) { 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); } Loading Loading
include/cutils/log.h +20 −20 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ extern "C" { #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 Loading @@ -89,7 +89,7 @@ extern "C" { #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 Loading @@ -98,13 +98,13 @@ extern "C" { * 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 Loading @@ -112,13 +112,13 @@ extern "C" { * 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 Loading @@ -126,13 +126,13 @@ extern "C" { * 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 Loading @@ -140,13 +140,13 @@ extern "C" { * 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 Loading @@ -160,7 +160,7 @@ extern "C" { #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 Loading @@ -169,7 +169,7 @@ extern "C" { * debug priority. */ #ifndef IF_LOGD #define IF_LOGD() IF_LOG(LOG_DEBUG, LOG_TAG) #define IF_LOGD() IF_ALOG(LOG_DEBUG, LOG_TAG) #endif /* Loading @@ -177,7 +177,7 @@ extern "C" { * info priority. */ #ifndef IF_LOGI #define IF_LOGI() IF_LOG(LOG_INFO, LOG_TAG) #define IF_LOGI() IF_ALOG(LOG_INFO, LOG_TAG) #endif /* Loading @@ -185,7 +185,7 @@ extern "C" { * warn priority. */ #ifndef IF_LOGW #define IF_LOGW() IF_LOG(LOG_WARN, LOG_TAG) #define IF_LOGW() IF_ALOG(LOG_WARN, LOG_TAG) #endif /* Loading @@ -193,7 +193,7 @@ extern "C" { * error priority. */ #ifndef IF_LOGE #define IF_LOGE() IF_LOG(LOG_ERROR, LOG_TAG) #define IF_LOGE() IF_ALOG(LOG_ERROR, LOG_TAG) #endif Loading Loading @@ -340,12 +340,12 @@ extern "C" { * 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 Loading @@ -368,8 +368,8 @@ extern "C" { /* * 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 Loading
logwrapper/logwrapper.c +9 −9 Original line number Diff line number Diff line Loading @@ -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); } Loading Loading @@ -60,7 +60,7 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) { 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; } } Loading @@ -68,7 +68,7 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) { 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 Loading @@ -84,21 +84,21 @@ void parent(const char *tag, int seg_fault_on_exit, int parent_read) { // 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 Loading @@ -111,7 +111,7 @@ void child(int argc, char* argv[]) { 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); } Loading