Commit 73081e56 authored by Olivier Crête's avatar Olivier Crête

agent: Print libnice debug messages when setting G_MESSAGES_DEBUG appropriately

This way all the debug can be controlled from one place.

Also disable -Wsuggest-attribute=format with -Werror because gcc 4.8.3
erroneously suggested it.
parent 33be596f
......@@ -38,6 +38,8 @@
# include <config.h>
#endif
#include <string.h>
#include "debug.h"
#include "stunagent.h"
......@@ -60,37 +62,41 @@ static const GDebugKey keys[] = {
{ NULL, 0},
};
static void
stun_handler (const char *format, va_list ap)
{
g_logv ("libnice-stun", G_LOG_LEVEL_DEBUG, format, ap);
}
void nice_debug_init (void)
{
static gboolean debug_initialized = FALSE;
const gchar *flags_string;
guint flags;
const gchar *gflags_string;
guint flags = 0;
if (!debug_initialized) {
debug_initialized = TRUE;
flags_string = g_getenv ("NICE_DEBUG");
gflags_string = g_getenv ("G_MESSAGES_DEBUG");
nice_debug_disable (TRUE);
if (flags_string != NULL) {
if (flags_string)
flags = g_parse_debug_string (flags_string, keys, 4);
if (gflags_string && strstr (gflags_string, "libnice-pseudotcp-verbose"))
flags |= NICE_DEBUG_PSEUDOTCP_VERBOSE;
if (flags & NICE_DEBUG_NICE)
nice_debug_enable (FALSE);
if (flags & NICE_DEBUG_STUN)
stun_debug_enable ();
stun_set_debug_handler (stun_handler);
nice_debug_enable (TRUE);
/* Set verbose before normal so that if we use 'all', then only
normal debug is enabled, we'd need to set pseudotcp-verbose without the
pseudotcp flag in order to actually enable verbose pseudotcp */
if (flags & NICE_DEBUG_PSEUDOTCP_VERBOSE)
pseudo_tcp_set_debug_level (PSEUDO_TCP_DEBUG_VERBOSE);
if (flags & NICE_DEBUG_PSEUDOTCP)
else
pseudo_tcp_set_debug_level (PSEUDO_TCP_DEBUG_NORMAL);
}
}
}
#ifndef NDEBUG
......
......@@ -159,6 +159,7 @@ AS_IF([test "$enable_compile_warnings" = "maximum" -o \
])
AS_IF([test "x$enable_compile_warnings" = "xerror"],[
NICE_ADD_FLAG([-Werror])
NICE_ADD_FLAG([-Wno-suggest-attribute=format])
])
#
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment