[gnome-online-accounts/wip/oauth2: 1/10] webview: Attach a SoupLogger to the session
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/wip/oauth2: 1/10] webview: Attach a SoupLogger to the session
- Date: Thu, 13 Sep 2012 14:32:48 +0000 (UTC)
commit ab7c6c74d400c933eefb258cc8be29b1ce24afad
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Sep 11 18:13:01 2012 +0200
webview: Attach a SoupLogger to the session
Use g_log_default_handler as the SoupLoggerPrinter.
src/goabackend/goawebview.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/goabackend/goawebview.c b/src/goabackend/goawebview.c
index 56efc2c..b0acc51 100644
--- a/src/goabackend/goawebview.c
+++ b/src/goabackend/goawebview.c
@@ -111,6 +111,20 @@ web_view_is_loading (GoaWebView *self)
}
static void
+web_view_log_printer (SoupLogger *logger,
+ SoupLoggerLogLevel level,
+ gchar direction,
+ const gchar *data,
+ gpointer user_data)
+{
+ gchar *message;
+
+ message = g_strdup_printf ("%c %s", direction, data);
+ g_log_default_handler ("goa", G_LOG_LEVEL_DEBUG, message, NULL);
+ g_free (message);
+}
+
+static void
web_view_notify_load_status_cb (GObject *object, GParamSpec *pspec, gpointer user_data)
{
GoaWebView *self = GOA_WEB_VIEW (user_data);
@@ -214,6 +228,7 @@ goa_web_view_init (GoaWebView *self)
GoaWebViewPrivate *priv;
GtkWidget *scrolled_window;
SoupCookieJar *cookie_jar;
+ SoupLogger *logger;
SoupSession *session;
self->priv = GOA_WEB_VIEW_GET_PRIVATE (self);
@@ -229,6 +244,11 @@ goa_web_view_init (GoaWebView *self)
soup_session_add_feature (session, SOUP_SESSION_FEATURE (cookie_jar));
g_object_unref (cookie_jar);
+ logger = soup_logger_new (SOUP_LOGGER_LOG_BODY, -1);
+ soup_logger_set_printer (logger, web_view_log_printer, NULL, NULL);
+ soup_session_add_feature (session, SOUP_SESSION_FEATURE (logger));
+ g_object_unref (logger);
+
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
GTK_STYLE_CLASS_OSD);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]