tizen_2.0 merged
[framework/system/dlog.git] / include / dlog.h
index 2368313..9a9f69e 100755 (executable)
@@ -81,6 +81,7 @@ typedef enum {
     LOG_ID_MAIN = 0,
     LOG_ID_RADIO,
     LOG_ID_SYSTEM,
+    LOG_ID_APPS,
     LOG_ID_MAX
 } log_id_t;
 
@@ -372,6 +373,101 @@ typedef enum {
                : (void)0 )
 #endif
 
+// ---------------------------------------------------------------------
+
+/**
+ * Simplified macro to send a verbose log message using the current LOG_TAG.
+ */
+#ifndef ALOGV
+#if LOG_NDEBUG
+#define ALOGV(...)   ((void)0)
+#else
+#define ALOGV(...) ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
+
+#endif
+#endif
+
+/**
+ * Simplified macro to send a conditional verbose log message using the current LOG_TAG.
+ */
+#ifndef ALOGV_IF
+#if LOG_NDEBUG
+#define ALOGV_IF(cond, ...)   ((void)0)
+#else
+#define ALOGV_IF(cond, ...) \
+    ( (CONDITION(cond)) \
+    ? ((void)ALOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__)) \
+    : (void)0 )
+#endif
+#endif
+
+/**
+ * Simplified macro to send a debug log message using the current LOG_TAG.
+ */
+#ifndef ALOGD
+#define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
+#endif
+
+/**
+ * Simplified macro to send a conditional debug log message using the current LOG_TAG.
+ */
+#ifndef ALOGD_IF
+#define ALOGD_IF(cond, ...) \
+    ( (CONDITION(cond)) \
+    ? ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__)) \
+    : (void)0 )
+#endif
+
+/**
+ * Simplified macro to send an info log message using the current LOG_TAG.
+ */
+#ifndef ALOGI
+#define ALOGI(...) ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__))
+#endif
+
+/**
+ * Simplified macro to send a conditional info log message using the current LOG_TAG.
+ */
+#ifndef ALOGI_IF
+#define ALOGI_IF(cond, ...) \
+    ( (CONDITION(cond)) \
+    ? ((void)ALOG(LOG_INFO, LOG_TAG, __VA_ARGS__)) \
+    : (void)0 )
+#endif
+
+/**
+ * Simplified macro to send a warning log message using the current LOG_TAG.
+ */
+#ifndef ALOGW
+#define ALOGW(...) ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__))
+#endif
+
+/**
+ * Simplified macro to send a conditional warning log message using the current LOG_TAG.
+ */
+#ifndef ALOGW_IF
+#define ALOGW_IF(cond, ...) \
+    ( (CONDITION(cond)) \
+    ? ((void)ALOG(LOG_WARN, LOG_TAG, __VA_ARGS__)) \
+    : (void)0 )
+#endif
+
+/**
+ * Simplified macro to send an error log message using the current LOG_TAG.
+ */
+#ifndef ALOGE
+#define ALOGE(...) ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__))
+#endif
+
+/**
+ * Simplified macro to send a conditional error log message using the current LOG_TAG.
+ */
+#ifndef ALOGE_IF
+#define ALOGE_IF(cond, ...) \
+    ( (CONDITION(cond)) \
+    ? ((void)ALOG(LOG_ERROR, LOG_TAG, __VA_ARGS__)) \
+    : (void)0 )
+#endif
 // TODO : support fatal log
 
 // ---------------------------------------------------------------------
@@ -399,6 +495,18 @@ typedef enum {
     vprint_log(D##priority, tag, fmt, args)
 #endif
 
+#ifndef ALOG
+#define ALOG(priority, tag, ...) \
+       print_apps_log(D##priority, tag, __VA_ARGS__)
+#endif
+/**
+ * Log macro that allows you to pass in a varargs ("args" is a va_list).
+ */
+#ifndef ALOG_VA
+#define ALOG_VA(priority, tag, fmt, args) \
+    vprint_apps_log(D##priority, tag, fmt, args)
+#endif
+
 /**
  * Basic radio log macro that allows you to specify a priority and a tag.
  */
@@ -438,6 +546,12 @@ typedef enum {
  * The stuff in the rest of this file should not be used directly.
  */
 
+#define print_apps_log(prio, tag, fmt...) \
+       __dlog_print(LOG_ID_APPS, prio, tag, fmt)
+
+#define vprint_apps_log(prio, tag, fmt...) \
+       __dlog_vprint(LOG_ID_APPS, prio, tag, fmt)
+
 #define print_log(prio, tag, fmt...) \
        __dlog_print(LOG_ID_MAIN, prio, tag, fmt)