]> spindle.queued.net Git - midori/commitdiff
Print soup log if MIDORI_SOUP_DEBUG is set (levels 1-3)
authorChristian Dywan <christian@twotoasts.de>
Tue, 17 Feb 2009 13:17:28 +0000 (14:17 +0100)
committerChristian Dywan <christian@twotoasts.de>
Tue, 17 Feb 2009 13:17:28 +0000 (14:17 +0100)
midori/main.c

index d412cd99920a17556e0bacf91d75a0b62be82af8..fe7f62ba4583d07dde1e5c541d5abdd0723c53af 100644 (file)
@@ -1366,6 +1366,20 @@ soup_session_settings_notify_ident_string_cb (MidoriWebSettings* settings,
     g_free (ident_string);
 }
 
+static void
+midori_soup_session_debug (SoupSession* session)
+{
+    const char* soup_debug = g_getenv ("MIDORI_SOUP_DEBUG");
+
+    if (soup_debug)
+    {
+        gint soup_debug_level = atoi (soup_debug);
+        SoupLogger* logger = soup_logger_new (soup_debug_level, -1);
+        soup_logger_attach (logger, session);
+        g_object_unref (logger);
+    }
+}
+
 /* The following code hooks up to any created soup session in order to
    modify preferences. This is *not* a generally advisable technique
    but merely a preliminary workaround until WebKit exposes its session. */
@@ -1396,6 +1410,7 @@ soup_session_constructed_cb (GObject* object)
         G_CALLBACK (soup_session_settings_notify_ident_string_cb), object);
 
     soup_session_add_feature_by_type (session, KATZE_TYPE_HTTP_AUTH);
+    midori_soup_session_debug (session);
 
     feature = g_object_new (KATZE_TYPE_HTTP_COOKIES, NULL);
     config_file = build_config_filename ("cookies.txt");
@@ -1977,6 +1992,7 @@ main (int    argc,
         g_signal_connect (settings, "notify::ident-string",
             G_CALLBACK (soup_session_settings_notify_ident_string_cb), s_session);
         soup_session_add_feature_by_type (s_session, KATZE_TYPE_HTTP_AUTH);
+        midori_soup_session_debug (s_session);
         g_object_unref (net);
     }
     #endif