GnuTLS: Setup logging

This commit is contained in:
Nils Maier 2014-01-06 13:34:03 +01:00
parent 2571bf4a36
commit 7777e1cb37

View File

@ -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