[glib-networking] gnutls: add some (#ifdeffed-out) debugging support



commit 20c2da8ffbec414983306c8ffe24ccfd3e02cb25
Author: Dan Winship <danw gnome org>
Date:   Tue Oct 18 13:53:13 2011 -0400

    gnutls: add some (#ifdeffed-out) debugging support

 tls/gnutls/gtlsbackend-gnutls.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/tls/gnutls/gtlsbackend-gnutls.c b/tls/gnutls/gtlsbackend-gnutls.c
index 6d9159d..c7c4ba3 100644
--- a/tls/gnutls/gtlsbackend-gnutls.c
+++ b/tls/gnutls/gtlsbackend-gnutls.c
@@ -98,6 +98,14 @@ static struct gcry_thread_cbs gtls_gcry_threads_win32 = {		 \
 
 #endif
 
+#ifdef GTLS_GNUTLS_DEBUG
+static void
+gtls_log_func (int level, const char *msg)
+{
+  g_print ("GTLS: %s", msg);
+}
+#endif
+
 static gpointer
 gtls_gnutls_init (gpointer data)
 {
@@ -108,6 +116,11 @@ gtls_gnutls_init (gpointer data)
 #endif
   gnutls_global_init ();
 
+#ifdef GTLS_GNUTLS_DEBUG
+  gnutls_global_set_log_function (gtls_log_func);
+  gnutls_global_set_log_level (9);
+#endif
+
   /* Leak the module to keep it from being unloaded. */
   g_type_plugin_use (g_type_get_plugin (G_TYPE_TLS_BACKEND_GNUTLS));
   return NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]