Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF)

Change-Id: Ia9a357dec5ad12eea93fd03401a3b02b38e4e94f
This commit is contained in:
Steve Block 2011-10-20 11:54:09 +01:00
parent 61fbcbe976
commit 66b68757f6
7 changed files with 45 additions and 36 deletions

View File

@ -47,7 +47,7 @@ extern "C" {
// ---------------------------------------------------------------------
/*
* Normally we strip LOGV (VERBOSE messages) from release builds.
* Normally we strip ALOGV (VERBOSE messages) from release builds.
* You can modify this (for example with "#define LOG_NDEBUG 0"
* at the top of your source file) to change that behavior.
*/
@ -73,27 +73,33 @@ extern "C" {
/*
* Simplified macro to send a verbose log message using the current LOG_TAG.
*/
#ifndef LOGV
#ifndef ALOGV
#if LOG_NDEBUG
#define LOGV(...) ((void)0)
#define ALOGV(...) ((void)0)
#else
#define LOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
#define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
#endif
// Temporary measure for code still using old LOG macros.
#ifndef LOGV
#define LOGV ALOGV
#endif
#define ALOGV LOGV
#endif
#define CONDITION(cond) (__builtin_expect((cond)!=0, 0))
#ifndef LOGV_IF
#ifndef ALOGV_IF
#if LOG_NDEBUG
#define LOGV_IF(cond, ...) ((void)0)
#define ALOGV_IF(cond, ...) ((void)0)
#else
#define LOGV_IF(cond, ...) \
#define ALOGV_IF(cond, ...) \
( (CONDITION(cond)) \
? ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
: (void)0 )
#endif
#define ALOGV_IF LOGV_IF
// Temporary measure for code still using old LOG macros.
#ifndef LOGV_IF
#define LOGV_IF ALOGV_IF
#endif
#endif
/*
@ -166,13 +172,16 @@ extern "C" {
* Conditional based on whether the current LOG_TAG is enabled at
* verbose priority.
*/
#ifndef IF_LOGV
#ifndef IF_ALOGV
#if LOG_NDEBUG
#define IF_LOGV() if (false)
#define IF_ALOGV() if (false)
#else
#define IF_LOGV() IF_ALOG(LOG_VERBOSE, LOG_TAG)
#define IF_ALOGV() IF_ALOG(LOG_VERBOSE, LOG_TAG)
#endif
// Temporary measure for code still using old LOG macros.
#ifndef IF_LOGV
#define IF_LOGV IF_ALOGV
#endif
#define IF_ALOGV IF_LOGV
#endif
/*

View File

@ -25,13 +25,13 @@
#include <cutils/log.h>
#else
#include <stdio.h>
#define LOG(level, ...) \
#define ALOG(level, ...) \
((void)printf("cutils:" level "/" LOG_TAG ": " __VA_ARGS__))
#define LOGV(...) LOG("V", __VA_ARGS__)
#define LOGD(...) LOG("D", __VA_ARGS__)
#define LOGI(...) LOG("I", __VA_ARGS__)
#define LOGW(...) LOG("W", __VA_ARGS__)
#define LOGE(...) LOG("E", __VA_ARGS__)
#define ALOGV(...) ALOG("V", __VA_ARGS__)
#define LOGD(...) ALOG("D", __VA_ARGS__)
#define LOGI(...) ALOG("I", __VA_ARGS__)
#define LOGW(...) ALOG("W", __VA_ARGS__)
#define LOGE(...) ALOG("E", __VA_ARGS__)
#define LOG_ALWAYS_FATAL(...) do { LOGE(__VA_ARGS__); exit(1); } while (0)
#endif

View File

@ -130,7 +130,7 @@ static void init(void)
if (gPropFd < 0) {
//LOGW("not connected to system property server\n");
} else {
//LOGV("Connected to system property server\n");
//ALOGV("Connected to system property server\n");
}
}
@ -140,7 +140,7 @@ int property_get(const char *key, char *value, const char *default_value)
char recvBuf[1+PROPERTY_VALUE_MAX];
int len = -1;
//LOGV("PROPERTY GET [%s]\n", key);
//ALOGV("PROPERTY GET [%s]\n", key);
pthread_once(&gInitOnce, init);
if (gPropFd < 0) {
@ -194,7 +194,7 @@ int property_get(const char *key, char *value, const char *default_value)
assert(0);
return -1;
}
//LOGV("PROP [found=%d def='%s'] (%d) [%s]: [%s]\n",
//ALOGV("PROP [found=%d def='%s'] (%d) [%s]: [%s]\n",
// recvBuf[0], default_value, len, key, value);
return len;
@ -207,7 +207,7 @@ int property_set(const char *key, const char *value)
char recvBuf[1];
int result = -1;
//LOGV("PROPERTY SET [%s]: [%s]\n", key, value);
//ALOGV("PROPERTY SET [%s]: [%s]\n", key, value);
pthread_once(&gInitOnce, init);
if (gPropFd < 0)
@ -241,7 +241,7 @@ int property_set(const char *key, const char *value)
int property_list(void (*propfn)(const char *key, const char *value, void *cookie),
void *cookie)
{
//LOGV("PROPERTY LIST\n");
//ALOGV("PROPERTY LIST\n");
pthread_once(&gInitOnce, init);
if (gPropFd < 0)
return -1;

View File

@ -60,7 +60,7 @@ void qtaguid_resTrack(void) {
static int write_ctrl(const char *cmd) {
int fd, res, savedErrno;
LOGV("write_ctrl(%s)", cmd);
ALOGV("write_ctrl(%s)", cmd);
fd = TEMP_FAILURE_RETRY(open(CTRL_PROCPATH, O_WRONLY));
if (fd < 0) {
@ -107,7 +107,7 @@ int qtaguid_tagSocket(int sockfd, int tag, uid_t uid) {
snprintf(lineBuf, sizeof(lineBuf), "t %d %llu %d", sockfd, kTag, uid);
LOGV("Tagging socket %d with tag %llx{%u,0} for uid %d", sockfd, kTag, tag, uid);
ALOGV("Tagging socket %d with tag %llx{%u,0} for uid %d", sockfd, kTag, tag, uid);
res = write_ctrl(lineBuf);
if (res < 0) {
@ -122,7 +122,7 @@ int qtaguid_untagSocket(int sockfd) {
char lineBuf[CTRL_MAX_INPUT_LEN];
int res;
LOGV("Untagging socket %d", sockfd);
ALOGV("Untagging socket %d", sockfd);
snprintf(lineBuf, sizeof(lineBuf), "u %d", sockfd);
res = write_ctrl(lineBuf);
@ -137,7 +137,7 @@ int qtaguid_setCounterSet(int counterSetNum, uid_t uid) {
char lineBuf[CTRL_MAX_INPUT_LEN];
int res;
LOGV("Setting counters to set %d for uid %d", counterSetNum, uid);
ALOGV("Setting counters to set %d for uid %d", counterSetNum, uid);
snprintf(lineBuf, sizeof(lineBuf), "s %d %d", counterSetNum, uid);
res = write_ctrl(lineBuf);
@ -149,7 +149,7 @@ int qtaguid_deleteTagData(int tag, uid_t uid) {
int fd, cnt = 0, res = 0;
uint64_t kTag = (uint64_t)tag << 32;
LOGV("Deleting tag data with tag %llx{%d,0} for uid %d", kTag, tag, uid);
ALOGV("Deleting tag data with tag %llx{%d,0} for uid %d", kTag, tag, uid);
pthread_once(&resTrackInitDone, qtaguid_resTrack);

View File

@ -103,7 +103,7 @@ struct str_parms *str_parms_create_str(const char *_string)
if (!str)
goto err_strdup;
LOGV("%s: source string == '%s'\n", __func__, _string);
ALOGV("%s: source string == '%s'\n", __func__, _string);
kvpair = strtok_r(str, ";", &tmpstr);
while (kvpair && *kvpair) {
@ -137,7 +137,7 @@ next_pair:
}
if (!items)
LOGV("%s: no items found in string\n", __func__);
ALOGV("%s: no items found in string\n", __func__);
free(str);

View File

@ -336,7 +336,7 @@ validate(struct disk_info *dinfo)
}
#if 1
LOGV("Device/file %s: size=%llu bytes, num_lba=%u, sect_size=%d",
ALOGV("Device/file %s: size=%llu bytes, num_lba=%u, sect_size=%d",
dinfo->device, disk_size, dinfo->num_lba, dinfo->sect_size);
#endif

View File

@ -272,7 +272,7 @@ void VectorImpl::release_storage()
void* VectorImpl::_grow(size_t where, size_t amount)
{
// LOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
// ALOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
// this, (int)where, (int)amount, (int)mCount, (int)capacity());
if (where > mCount)
@ -281,7 +281,7 @@ void* VectorImpl::_grow(size_t where, size_t amount)
const size_t new_size = mCount + amount;
if (capacity() < new_size) {
const size_t new_capacity = max(kMinVectorCapacity, ((new_size*3)+1)/2);
// LOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity);
// ALOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity);
if ((mStorage) &&
(mCount==where) &&
(mFlags & HAS_TRIVIAL_COPY) &&
@ -325,7 +325,7 @@ void VectorImpl::_shrink(size_t where, size_t amount)
if (!mStorage)
return;
// LOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
// ALOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d",
// this, (int)where, (int)amount, (int)mCount, (int)capacity());
if (where >= mCount)
@ -334,7 +334,7 @@ void VectorImpl::_shrink(size_t where, size_t amount)
const size_t new_size = mCount - amount;
if (new_size*3 < capacity()) {
const size_t new_capacity = max(kMinVectorCapacity, new_size*2);
// LOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity);
// ALOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity);
if ((where == mCount-amount) &&
(mFlags & HAS_TRIVIAL_COPY) &&
(mFlags & HAS_TRIVIAL_DTOR))