Use dlog to debug agent 28/262428/20 accepted/tizen/unified/20210824.123845 submit/tizen/20210818.024548
authorYoungHun Kim <yh8004.kim@samsung.com>
Tue, 10 Aug 2021 09:29:45 +0000 (18:29 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Fri, 13 Aug 2021 08:51:30 +0000 (17:51 +0900)
 - Log tag is LIBNICE_AGENT

Change-Id: I19252689850078b8452e4cd7ae51dc04f275bf4f

agent/Makefile.am
agent/agent-priv.h
agent/debug.c
configure.ac
packaging/libnice.spec
socket/Makefile.am
tests/Makefile.am

index 118520f..1927449 100644 (file)
@@ -18,6 +18,10 @@ AM_CFLAGS = \
        -I $(top_srcdir)/socket \
        -I $(top_srcdir)/stun
 
+if USE_DLOG
+  AM_CFLAGS += $(DLOG_CFLAGS) -DUSE_DLOG
+endif
+
 if WINDOWS
   AM_CFLAGS += -DWINVER=0x0501 # _WIN32_WINNT_WINXP
 endif
@@ -98,6 +102,10 @@ libagent_la_DEPENDENCIES = \
        $(top_builddir)/socket/libsocket.la \
        $(top_builddir)/stun/libstun.la
 
+if USE_DLOG
+  libagent_la_LIBADD += $(DLOG_LIBS)
+endif
+
 if WINDOWS
   libagent_la_LIBADD += -liphlpapi -lws2_32
 endif
index d6c488c..5cca7ad 100644 (file)
 
 #include "agent.h"
 
+#if defined(USE_DLOG)
+#include <dlog.h>
+#undef LOG_TAG
+#define LOG_TAG "LIBNICE_AGENT"
+#endif
+
 /**
  * NiceInputMessageIter:
  * @message: index of the message currently being written into
@@ -322,9 +328,14 @@ static inline void nice_debug_verbose (const char *fmt, ...) { }
 #else
 gboolean nice_debug_is_enabled (void);
 gboolean nice_debug_is_verbose (void);
+#ifdef USE_DLOG
+#define nice_debug(fmt, arg...) \
+  do { if (nice_debug_is_enabled ()) LOGD (fmt, ##arg); } while (0)
+#else
 void nice_debug (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
+#endif /* USE_DLOG */
 void nice_debug_verbose (const char *fmt, ...) G_GNUC_PRINTF (1, 2);
-#endif
+#endif /* NDEBUG */
 
 #if !GLIB_CHECK_VERSION(2, 59, 0)
 #if __GNUC__ > 6
index 08ffb07..280ceda 100644 (file)
@@ -153,6 +153,7 @@ void nice_debug_disable (gboolean with_stun)
 }
 
 #ifndef NDEBUG
+#ifndef USE_DLOG
 void nice_debug (const char *fmt, ...)
 {
   va_list ap;
@@ -162,6 +163,7 @@ void nice_debug (const char *fmt, ...)
     va_end (ap);
   }
 }
+#endif
 void nice_debug_verbose (const char *fmt, ...)
 {
   va_list ap;
index 677fa12..5759da3 100644 (file)
@@ -373,6 +373,25 @@ if test "x$enable_static_plugins" = xyes; then
     [Define if static plugins should be built])
 fi
 AM_CONDITIONAL(GST_PLUGIN_BUILD_STATIC, test "x$enable_static_plugins" = "xyes")
+dnl end
+
+dnl Check for dlog
+AC_ARG_ENABLE(dlog, AC_HELP_STRING([--enable-dlog], [using dlog]),
+[
+ case "${enableval}" in
+         yes) USE_DLOG=yes ;;
+         no)  USE_DLOG=no ;;
+         *)   AC_MSG_ERROR(bad value ${enableval} for --enable-dlog) ;;
+ esac
+],[USE_DLOG=no])
+
+if test "x$USE_DLOG" = "xyes"; then
+        PKG_CHECK_MODULES(DLOG, dlog)
+        AC_SUBST(DLOG_CFLAGS)
+        AC_SUBST(DLOG_LIBS)
+fi
+AM_CONDITIONAL(USE_DLOG, test "x$USE_DLOG" = "xyes")
+dnl end
 
 case $host_os in
   solaris*)
index 8928a2c..2daba57 100644 (file)
@@ -1,7 +1,7 @@
 Name:       libnice
 Summary:    Library for implementing Interactive Connectivity Establishment (ICE) standard (RFC 5245 & RFC 8445)
 Version:    0.1.17
-Release:    0
+Release:    1
 Group:      Multimedia/Libraries
 License:    LGPL-2.1
 Source0:    %{name}-%{version}.tar.gz
@@ -10,6 +10,7 @@ Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 BuildRequires: pkgconfig(glib-2.0) >= 2.32.0
 BuildRequires: pkgconfig(openssl1.1)
+BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(gstreamer-1.0)
 
 %define gst_branch  1.0
@@ -36,7 +37,8 @@ export NOCONFIGURE=1
        --disable-static \
        --disable-gtk-doc \
        --disable-gtk-doc-html \
-       --disable-gtk-doc-pdf
+       --disable-gtk-doc-pdf \
+       --enable-dlog
 
 make %{?jobs:-j%jobs}
 
index 2560f17..a8599fc 100644 (file)
@@ -17,6 +17,10 @@ AM_CFLAGS = \
        -I $(top_srcdir)/agent \
        -I $(top_srcdir)/
 
+if USE_DLOG
+  AM_CFLAGS += $(DLOG_CFLAGS) -DUSE_DLOG
+endif
+
 noinst_LTLIBRARIES = libsocket.la
 
 libsocket_la_SOURCES = \
@@ -42,4 +46,8 @@ libsocket_la_SOURCES = \
        udp-turn-over-tcp.h \
        udp-turn-over-tcp.c
 
+if USE_DLOG
+       libsocket_la_LIBADD += $(DLOG_LIBS)
+endif
+
 EXTRA_DIST = meson.build
index 473e5e0..bf2ea64 100644 (file)
@@ -19,6 +19,10 @@ AM_CFLAGS = \
        -I $(top_srcdir)/stun
 AM_CPPFLAGS = -DG_LOG_DOMAIN=\"libnice-tests\"
 
+if USE_DLOG
+  AM_CFLAGS += $(DLOG_CFLAGS) -DUSE_DLOG
+endif
+
 AM_TESTS_ENVIRONMENT = \
        G_MESSAGES_DEBUG=all \
        NICE_DEBUG=all \
@@ -26,6 +30,10 @@ AM_TESTS_ENVIRONMENT = \
 
 COMMON_LDADD = $(top_builddir)/agent/libagent.la $(top_builddir)/socket/libsocket.la $(GLIB_LIBS) $(GUPNP_LIBS)
 
+if USE_DLOG
+  COMMON_LDADD += $(DLOG_LIBS)
+endif
+
 check_PROGRAMS = \
        test-pseudotcp \
        test-pseudotcp-fin \