最終更新:2013-11-21 (木) 02:23:31 (3781d)
AOSP/system/core/libcutils/loghack.h
Android 4.0.4
/** * This is a temporary hack to enable logging from cutils. */ #ifndef _CUTILS_LOGHACK_H #define _CUTILS_LOGHACK_H #ifdef HAVE_ANDROID_OS #include <cutils/log.h> #else #include <stdio.h> #define LOG(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 LOG_ALWAYS_FATAL(...) do { LOGE(__VA_ARGS__); exit(1); } while (0) #endif #endif // _CUTILS_LOGHACK_H
Android 4.1
/** * This is a temporary hack to enable logging from cutils. */ #ifndef _CUTILS_LOGHACK_H #define _CUTILS_LOGHACK_H #ifdef HAVE_ANDROID_OS #include <cutils/log.h> #else #include <stdio.h> #define ALOG(level, ...) \ ((void)printf("cutils:" level "/" LOG_TAG ": " __VA_ARGS__)) #define ALOGV(...) ALOG("V", __VA_ARGS__) #define ALOGD(...) ALOG("D", __VA_ARGS__) #define ALOGI(...) ALOG("I", __VA_ARGS__) #define ALOGW(...) ALOG("W", __VA_ARGS__) #define ALOGE(...) ALOG("E", __VA_ARGS__) #define LOG_ALWAYS_FATAL(...) do { ALOGE(__VA_ARGS__); exit(1); } while (0) #endif #endif // _CUTILS_LOGHACK_H