using dlog for logging
authorAmarnath Valluri <amarnath.valluri@linux.intel.com>
Thu, 24 Oct 2013 11:57:20 +0000 (14:57 +0300)
committerAmarnath Valluri <amarnath.valluri@linux.intel.com>
Wed, 20 Aug 2014 06:45:09 +0000 (09:45 +0300)
common/Makefile.am
common/log.h
configure.ac
daemon/Makefile.am
examples/Makefile.am
lib/Makefile.am
lib/message-port.pc.in
packaging/message-port.spec

index 5c829c3..494500e 100644 (file)
@@ -27,11 +27,11 @@ libmessageport_dbus_glue_la_SOURCES = \
     
 libmessageport_dbus_glue_la_CPPFLAGS = \
     -I$(top_builddir) \
-    $(GLIB_CFLAGS) $(GIO_CFLAGS) $(GIOUNIX_CFLAGS) \
+    $(GLIB_CFLAGS) $(GIO_CFLAGS) $(GIOUNIX_CFLAGS) $(DLOG_CFLAGS) \
     $(NULL)
 
 libmessageport_dbus_glue_la_LIBADD = \
-    $(GLIB_LIBS) $(GIO_LIBS) $(GIOUNIX_LIBS) \
+    $(GLIB_LIBS) $(GIO_LIBS) $(GIOUNIX_LIBS) $(DLOG_LIBS) \
     $(NULL)
 
 
index 7a03123..196f17e 100644 (file)
@@ -2,11 +2,26 @@
 #define _MSGPORT_LOG_H
 
 #include <glib.h>
+#include "config.h"
 
-#define LOG(log_func, frmt, args...) log_func("%s +%d:"frmt, __FILE__, __LINE__, ##args)
+#ifdef HAVE_DLOG
 
-#define DBG(frmt, args...)  LOG(g_debug, frmt, ##args)
-#define WARN(frmt, args...) LOG(g_warning, frmt, ##args)
-#define ERR(frmt, args...)  LOG(g_error, frmt, ##args)
+#   include <dlog.h>
+
+#   define __LOG(prio, frmt, args...) print_log(prio, LOG_TAG, "%s +%d:"frmt, __FILE__, __LINE__, ##args)
+
+#   define DBG(frmt, args...) __LOG(DLOG_DEBUG, frmt, ##args)
+#   define WARN(frmt, args...) __LOG(DLOG_WARN, frmt, ##args)
+#   define ERR(frmt, args...) __LOG(DLOG_ERROR, frmt, ##args)
+
+#else /* USE_DLOG */
+
+#   define __LOG(log_func, frmt, args...) log_func("%s +%d:"frmt, __FILE__, __LINE__, ##args)
+
+#   define DBG(frmt, args...)  __LOG(g_debug, frmt, ##args)
+#   define WARN(frmt, args...) __LOG(g_warning, frmt, ##args)
+#   define ERR(frmt, args...)  __LOG(g_error, frmt, ##args)
+
+#endif /* USE_DLOG */
 
 #endif /* _MSGPORT_LOG_H */
index c293083..dc5f263 100644 (file)
@@ -39,6 +39,10 @@ PKG_CHECK_MODULES([BUNDLE], [bundle])
 AC_SUBST(BUNDLE_CFLAGS)
 AC_SUBST(BUNDLE_LIBS)
 
+PKG_CHECK_MODULES([DLOG], [dlog], [AC_DEFINE([HAVE_DLOG], [1], [Use DLOG])])
+AC_SUBST(DLOG_CFLAGS)
+AC_SUBST(DLOG_LIBS)
+
 AC_DEFINE(MESSAGEPORT_BUS_ADDRESS, 
          ["unix:path=%s/.message-port", g_get_user_runtime_dir()],
          [messageport daemon server socket address])
index b14d22b..d93846b 100644 (file)
@@ -15,12 +15,13 @@ messageportd_SOURCES = \
 
 messageportd_CPPFLAGS = \
     -I$(top_builddir) \
-    $(GLIB_CLFAGS) $(GIO_CFLAGS) $(AUL_CFLAGS) $(PKGMGRINFO_CFLAGS)\
+    -DLOG_TAG=\"MESSAGEPORT/DAEMON\" \
+    $(GLIB_CLFAGS) $(GIO_CFLAGS) $(AUL_CFLAGS) $(PKGMGRINFO_CFLAGS) $(DLOG_CFLAGS) \
     $(NULL)
 
 messageportd_LDADD = \
     ../common/libmessageport-common.la \
-    $(GLIB_LIBS) $(GIO_LIBS) $(AUL_LIBS) $(PKGMGRINFO_LIBS) \
+    $(GLIB_LIBS) $(GIO_LIBS) $(AUL_LIBS) $(PKGMGRINFO_LIBS) $(DLOG_LIBS) \
     $(NULL)
 
 CLEANFILES = 
index 2a4cb5d..cc39af4 100644 (file)
@@ -1,10 +1,10 @@
 bin_PROGRAMS = msgport-example-app msgport-example-app-cpp
 
 msgport_example_app_SOURCES = test-app.c 
-msgport_example_app_LDADD = ../lib/libmessage-port.la $(GLIB_LIBS) $(BUNDLE_LIBS)
-msgport_example_app_CPPFLAGS  = -I../lib/ -I ../ $(GLIB_CFLAGS) $(BUNDLE_CFLAGS)
+msgport_example_app_LDADD = ../lib/libmessage-port.la $(GLIB_LIBS) $(BUNDLE_LIBS) $(DLOG_LIBS)
+msgport_example_app_CPPFLAGS  = -I../lib/ -I ../ $(GLIB_CFLAGS) $(BUNDLE_CFLAGS) $(DLOG_CFLAGS)
 
 msgport_example_app_cpp_SOURCES = test-app.cpp
-msgport_example_app_cpp_LDADD = ../lib/libmessage-port.la $(GLIB_LIBS) $(BUNDLE_LIBS)
-msgport_example_app_cpp_CXXFLAGS  = -I../lib/ -I ../ $(GLIB_CFLAGS) $(BUNDLE_CFLAGS)
+msgport_example_app_cpp_LDADD = ../lib/libmessage-port.la $(GLIB_LIBS) $(BUNDLE_LIBS) $(DLOG_LIBS)
+msgport_example_app_cpp_CXXFLAGS  = -I../lib/ -I ../ $(GLIB_CFLAGS) $(BUNDLE_CFLAGS) $(DLOG_CFLAGS)
 
index 16aa133..2c3b09a 100644 (file)
@@ -20,14 +20,15 @@ libmessage_port_la_include_HEADERS = \
 libmessage_port_la_CPPFLAGS = \
     -I . \
     -I $(top_builddir) \
-    -I $(top_builddir)/daemon \
-    $(GLIB_CFLAGS) $(GIO_CFLAGS) $(BUNDLE_CFLAGS) \
+    -DLOG_TAG=\"MESSAGEPORT/LIB\" \
+    $(GLIB_CFLAGS) $(GIO_CFLAGS) $(BUNDLE_CFLAGS) $(DLOG_CFLAGS) \
     -Wall -error
     $(NULL)
 
 libmessage_port_la_LIBADD = \
     ../common/libmessageport-common.la \
-    $(GLIB_LIBS) $(GIO_LIBS) $(BUNDLE_LIBS)
+    $(GLIB_LIBS) $(GIO_LIBS) $(BUNDLE_LIBS) $(DLOG_LIBS) \
+    $(NULL)
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = message-port.pc
index 2746b05..c10ba14 100644 (file)
@@ -7,7 +7,7 @@ Name: Message port client library
 Description: Message port client library for WRT plugin
 Version: @PACKAGE_VERSION@
 URL: @PACKAGE_URL@
-Requires: glib-2.0 >= 2.30 gio-2.0 gio-unix-2.0 bundle
-Libs: -L${libdir} 
+Requires: glib-2.0 >= 2.30 gio-2.0 gio-unix-2.0 bundle dlog
+Libs: -L${libdir} -lmessage-port
 Cflags: -I${includedir}
 
index f5160bb..44741c7 100644 (file)
@@ -10,6 +10,7 @@ License: LGPL-2.1+
 Source: %{name}-%{version}.tar.gz
 
 BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(gio-2.0)
 BuildRequires: pkgconfig(gio-unix-2.0)
 BuildRequires: pkgconfig(glib-2.0) >= 2.30