#include <cutils/log.h>
+/**
+ * These log statements are effectively executing only ALOG(_________, tag, fmt, ## args ).
+ * fprintf is only to cause compilation error when LOG_TAG is not provided,
+ * which breaks build on Linux (for OS_GENERIC).
+ */
+
#if LOG_NDEBUG
-#define LOG_VERBOSE(...) ((void)0)
+#define LOG_VERBOSE(tag, fmt, args...) \
+ do { \
+ (true) ? ((int)0) : fprintf(stderr, "%s" fmt , tag, ## args); \
+ } while (0)
#else // LOG_NDEBUG
-#define LOG_VERBOSE(tag, fmt, args...) ALOG(LOG_VERBOSE, tag, fmt, ## args)
+#define LOG_VERBOSE(tag, fmt, args...) \
+ do { \
+ (true) ? ALOG(LOG_VERBOSE, tag, fmt, ## args) : fprintf(stderr, "%s" fmt , tag, ## args); \
+ } while (0)
#endif // !LOG_NDEBUG
-#define LOG_DEBUG(tag, fmt, args...) ALOG(LOG_DEBUG, tag, fmt, ## args )
-#define LOG_INFO(tag, fmt, args...) ALOG(LOG_INFO, tag, fmt, ## args)
-#define LOG_WARN(tag, fmt, args...) ALOG(LOG_WARN, tag, fmt, ## args)
-#define LOG_ERROR(tag, fmt, args...) ALOG(LOG_ERROR, tag, fmt, ## args)
+
+#define LOG_DEBUG(tag, fmt, args...) \
+ do { \
+ (true) ? ALOG(LOG_DEBUG, tag, fmt, ## args ) : fprintf(stderr, "%s" fmt , tag, ## args); \
+ } while (0)
+#define LOG_INFO(tag, fmt, args...) \
+ do { \
+ (true) ? ALOG(LOG_INFO, tag, fmt, ## args) : fprintf(stderr, "%s" fmt , tag, ## args); \
+ } while (0)
+#define LOG_WARN(tag, fmt, args...) \
+ do { \
+ (true) ? ALOG(LOG_WARN, tag, fmt, ## args) : fprintf(stderr, "%s" fmt , tag, ## args); \
+ } while (0)
+#define LOG_ERROR(tag, fmt, args...) \
+ do { \
+ (true) ? ALOG(LOG_ERROR, tag, fmt, ## args) : fprintf(stderr, "%s" fmt , tag, ## args); \
+ } while (0)
#endif /* defined(OS_GENERIC) */