From 7777e1cb37c49bd3263df7c4b837816b4ebba341 Mon Sep 17 00:00:00 2001 From: Nils Maier Date: Mon, 6 Jan 2014 13:34:03 +0100 Subject: [PATCH] GnuTLS: Setup logging --- src/Platform.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Platform.cc b/src/Platform.cc index 13337914..1e562f3a 100644 --- a/src/Platform.cc +++ b/src/Platform.cc @@ -66,9 +66,19 @@ #ifdef HAVE_LIBGMP # include "a2gmp.h" #endif // HAVE_LIBGMP +#include "LogFactory.h" #define A2_MIN_GCRYPT_VERSION "1.2.4" +namespace { + void gnutls_log_callback(int level, const char *str) + { + using namespace aria2; + A2_LOG_DEBUG(fmt("GNUTLS: %d / %s", level, str)); + } +} + + namespace aria2 { bool Platform::initialized_ = false; @@ -120,6 +130,9 @@ bool Platform::setUp() throw DL_ABORT_EX(fmt("gnutls_global_init() failed, cause:%s", gnutls_strerror(r))); } + + gnutls_global_set_log_function(gnutls_log_callback); + gnutls_global_set_log_level(10); } #endif // HAVE_LIBGNUTLS