fix LOG_IF macro error
authorjuho <juho80.son@samsung.com>
Thu, 6 Dec 2012 09:12:57 +0000 (18:12 +0900)
committerjuho <juho80.son@samsung.com>
Thu, 6 Dec 2012 09:13:05 +0000 (18:13 +0900)
MACRO arguments error

Makefile.am
configure.ac
dlogutil.manifest
include/dlog.h
log.c
packaging/dlog.spec

index 2e82e56..737ed21 100755 (executable)
@@ -14,8 +14,11 @@ libdlog_la_SOURCES =  \
        log.c \
        include/dlog.h
 
+if SD_JOURNAL_SUPPORT
 libdlog_la_LIBADD = -lpthread -lsystemd-journal
-
+else
+libdlog_la_LIBADD = -lpthread
+endif
 bin_PROGRAMS= dlogutil
 
 dlogutil_SOURCES = \
index c5af179..66c40f2 100755 (executable)
@@ -19,6 +19,12 @@ AC_PROG_LIBTOOL
 # checks arch
 AM_CONDITIONAL(DEVELOP_VER, test $DEVELOP_VER = yes)
 
+SD_JOURNAL_SUPPORT=no
+
+AC_DEFINE([SD_JOURNAL_SUPPORT], [], [Description])
+
+AM_CONDITIONAL(SD_JOURNAL_SUPPORT, test $SD_JOURNAL_SUPPORT = yes)
+
 #AM_CONDITIONAL([ARCH_IS_ARM], [test "x$ARCH" = "xarm"])
 if test "x$ARCH" = "xarm" ; then
        DLOG_CFLAGS="-D__arm__"
@@ -28,6 +34,7 @@ fi
 
 AC_SUBST(DLOG_CFLAGS)
 
+
 dnl AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
 # Checks for libraries.
 # Checks for header files.
index 2eecb07..116140b 100644 (file)
@@ -3,6 +3,7 @@
                <domain name="dlogutil" policy="restricted"/>
        <provide>
                <label name="dlogutil::dlog"/>
+               <label name="dlogutil::dlogscript"/>
        </provide>
        </define>
        <request>
@@ -11,5 +12,6 @@
        <assign>
                <filesystem path="/usr/bin/dlogutil" label="dlogutil"/>
                <filesystem path="/opt/etc/dlog" label="dlogutil::dlog"/>
+               <filesystem path="/etc/rc.d/init.d/dlog.sh" label="dlogutil::dlogscript"/>
        </assign>
 </manifest>
index fdd5440..ee0624c 100755 (executable)
@@ -104,9 +104,9 @@ typedef enum {
  */
 #ifndef LOGV_IF
 #if LOG_NDEBUG
-#define LOGV_IF(cond, ...)   (0)
+#define LOGV_IF(cond, format, arg...)   (0)
 #else
-#define LOGV_IF(cond, ...) \
+#define LOGV_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (LOG(LOG_VERBOSE, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -122,7 +122,7 @@ typedef enum {
  * Simplified macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef LOGD_IF
-#define LOGD_IF(cond, ...) \
+#define LOGD_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (LOG(LOG_DEBUG, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -138,7 +138,7 @@ typedef enum {
  * Simplified macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef LOGI_IF
-#define LOGI_IF(cond, ...) \
+#define LOGI_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (LOG(LOG_INFO, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -154,7 +154,7 @@ typedef enum {
  * Simplified macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef LOGW_IF
-#define LOGW_IF(cond, ...) \
+#define LOGW_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (LOG(LOG_WARN, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -170,7 +170,7 @@ typedef enum {
  * Simplified macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef LOGE_IF
-#define LOGE_IF(cond, ...) \
+#define LOGE_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (LOG(LOG_ERROR, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -185,7 +185,7 @@ typedef enum {
  * Simplified macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef LOGF_IF
-#define LOGF_IF(cond, ...) \
+#define LOGF_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (LOG(LOG_FATAL, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -207,9 +207,9 @@ typedef enum {
  */
 #ifndef RLOGV_IF
 #if LOG_NDEBUG
-#define RLOGV_IF(cond, ...)   (0)
+#define RLOGV_IF(cond, format, arg...)   (0)
 #else
-#define RLOGV_IF(cond, ...) \
+#define RLOGV_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (RLOG(LOG_VERBOSE, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -226,7 +226,7 @@ typedef enum {
  * Simplified radio macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef RLOGD_IF
-#define RLOGD_IF(cond, ...) \
+#define RLOGD_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (RLOG(LOG_DEBUG, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -242,7 +242,7 @@ typedef enum {
  * Simplified radio macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef RLOGI_IF
-#define RLOGI_IF(cond, ...) \
+#define RLOGI_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (RLOG(LOG_INFO, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -258,7 +258,7 @@ typedef enum {
  * Simplified radio macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef RLOGW_IF
-#define RLOGW_IF(cond, ...) \
+#define RLOGW_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (RLOG(LOG_WARN, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -274,7 +274,7 @@ typedef enum {
  * Simplified radio macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef RLOGE_IF
-#define RLOGE_IF(cond, ...) \
+#define RLOGE_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (RLOG(LOG_ERROR, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -289,7 +289,7 @@ typedef enum {
  * Simplified radio macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef RLOGF_IF
-#define RLOGF_IF(cond, ...) \
+#define RLOGF_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (RLOG(LOG_FATAL, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -312,9 +312,9 @@ typedef enum {
  */
 #ifndef SLOGV_IF
 #if LOG_NDEBUG
-#define SLOGV_IF(cond, ...)   (0)
+#define SLOGV_IF(cond, format, arg...)   (0)
 #else
-#define SLOGV_IF(cond, ...) \
+#define SLOGV_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (SLOG(LOG_VERBOSE, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -331,7 +331,7 @@ typedef enum {
  * Simplified system macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef SLOGD_IF
-#define SLOGD_IF(cond, ...) \
+#define SLOGD_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (SLOG(LOG_DEBUG, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -347,7 +347,7 @@ typedef enum {
  * Simplified system macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef SLOGI_IF
-#define SLOGI_IF(cond, ...) \
+#define SLOGI_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (SLOG(LOG_INFO, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -363,7 +363,7 @@ typedef enum {
  * Simplified system macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef SLOGW_IF
-#define SLOGW_IF(cond, ...) \
+#define SLOGW_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (SLOG(LOG_WARN, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -379,7 +379,7 @@ typedef enum {
  * Simplified system macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef SLOGE_IF
-#define SLOGE_IF(cond, ...) \
+#define SLOGE_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (SLOG(LOG_ERROR, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -394,7 +394,7 @@ typedef enum {
  * Simplified system macro to send a conditional verbose log message using the current LOG_TAG.
  */
 #ifndef SLOGF_IF
-#define SLOGF_IF(cond, ...) \
+#define SLOGF_IF(cond, format, arg...) \
        (((CONDITION(cond)) && (LOG_ON())) ? \
          (SLOG(LOG_FATAL, LOG_TAG, "%s:%s(%d)>"format, __MODULE__, __func__, __LINE__, ##arg)) : (0))
 #endif
@@ -580,7 +580,7 @@ int __dlog_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ..
  * @endcode
   */
 int __dlog_vprint(log_id_t log_id, int prio, const char *tag, const char *fmt, va_list ap);
-int _get_logging_on();
+int _get_logging_on(void);
 
 #ifdef __cplusplus
 }
diff --git a/log.c b/log.c
index 6c5235f..4abdcf9 100755 (executable)
--- a/log.c
+++ b/log.c
@@ -24,7 +24,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <dlog.h>
-#ifdef SD_JOURNAL_LOG
+#ifdef SD_JOURNAL_SUPPORT
 #include <systemd/sd-journal.h>
 #endif
 #define LOG_BUF_SIZE   1024
@@ -48,7 +48,7 @@ static int __write_to_log_null(log_id_t log_id, log_priority prio, const char *t
 {
        return -1;
 }
-#ifdef SD_JOURNAL_LOG
+#ifdef SD_JOURNAL_SUPPORT
 static int dlog_pri_to_journal_pri(log_priority prio)
 {
        int journal_prio = LOG_DEBUG;
@@ -149,7 +149,7 @@ static int __dlog_init(log_id_t log_id, log_priority prio, const char *tag, cons
        // get filtering info
        // open device
        if (write_to_log == __dlog_init) {
-#ifdef SD_JOURNAL_LOG
+#ifdef SD_JOURNAL_SUPPORT
                write_to_log = __write_to_log_sd_journal_print;
 #else
                init_dlog_level();
@@ -198,7 +198,7 @@ int __dlog_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ..
 
        return write_to_log(log_id, prio, tag, buf);
 }
-int _get_logging_on()
+int _get_logging_on(void)
 {
        return g_logging_on;
 }
index 15426cd..7f65658 100755 (executable)
@@ -1,8 +1,8 @@
 Name:       dlog
 Summary:    Logging service
-Version:    0.4.0
-Release:    5.1
-Group:      TO_BE/FILLED_IN
+Version:    0.4.1
+Release:    0.0
+Group:      System/Libraries
 License:    Apache License
 Source0:    %{name}-%{version}.tar.gz
 Source101:  packaging/dlog-main.service