Commit caed1cb3 authored by Olivier Crête's avatar Olivier Crête

debug: Enable based on G_MESSAGES_DEBUG

parent f4055e7f
......@@ -65,6 +65,15 @@ static const GDebugKey keys[] = {
{ NULL, 0},
};
static const GDebugKey gkeys[] = {
{ (gchar *)"libnice-stun", NICE_DEBUG_STUN },
{ (gchar *)"libnice", NICE_DEBUG_NICE },
{ (gchar *)"libnice-pseudotcp", NICE_DEBUG_PSEUDOTCP },
{ (gchar *)"libnice-pseudotcp-verbose", NICE_DEBUG_PSEUDOTCP_VERBOSE },
{ (gchar *)"libnice-verbose", NICE_DEBUG_NICE_VERBOSE },
{ NULL, 0},
};
static void
stun_handler (const char *format, va_list ap) G_GNUC_PRINTF (1, 0);
......@@ -89,6 +98,8 @@ void nice_debug_init (void)
if (flags_string)
flags = g_parse_debug_string (flags_string, keys, 4);
if (gflags_string)
flags |= g_parse_debug_string (gflags_string, gkeys, 4);
if (gflags_string && strstr (gflags_string, "libnice-pseudotcp-verbose"))
flags |= NICE_DEBUG_PSEUDOTCP_VERBOSE;
if (gflags_string && strstr (gflags_string, "libnice-nice-verbose")) {
......@@ -96,7 +107,11 @@ void nice_debug_init (void)
}
stun_set_debug_handler (stun_handler);
nice_debug_enable (TRUE);
debug_enabled = !!(flags & NICE_DEBUG_NICE);
if (flags & NICE_DEBUG_STUN)
stun_debug_enable ();
else
stun_debug_disable ();
if (flags & NICE_DEBUG_NICE_VERBOSE)
debug_verbose_enabled = TRUE;
......@@ -106,7 +121,7 @@ void nice_debug_init (void)
pseudotcp flag in order to actually enable verbose pseudotcp */
if (flags & NICE_DEBUG_PSEUDOTCP_VERBOSE)
pseudo_tcp_set_debug_level (PSEUDO_TCP_DEBUG_VERBOSE);
else
else if (flags & NICE_DEBUG_PSEUDOTCP)
pseudo_tcp_set_debug_level (PSEUDO_TCP_DEBUG_NORMAL);
}
}
......
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