summaryrefslogtreecommitdiff
path: root/src/journal/microhttpd-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal/microhttpd-util.c')
-rw-r--r--src/journal/microhttpd-util.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/journal/microhttpd-util.c b/src/journal/microhttpd-util.c
index 3844f7a03c..b07ae6dff3 100644
--- a/src/journal/microhttpd-util.c
+++ b/src/journal/microhttpd-util.c
@@ -39,3 +39,38 @@ void microhttpd_logger(void *arg, const char *fmt, va_list ap) {
log_metav(LOG_INFO, NULL, 0, NULL, f, ap);
REENABLE_WARNING;
}
+
+#ifdef HAVE_GNUTLS
+
+static int log_level_map[] = {
+ LOG_DEBUG,
+ LOG_WARNING, /* gnutls session audit */
+ LOG_DEBUG, /* gnutls debug log */
+ LOG_WARNING, /* gnutls assert log */
+ LOG_INFO, /* gnutls handshake log */
+ LOG_DEBUG, /* gnutls record log */
+ LOG_DEBUG, /* gnutls dtls log */
+ LOG_DEBUG,
+ LOG_DEBUG,
+ LOG_DEBUG,
+ LOG_DEBUG, /* gnutls hard log */
+ LOG_DEBUG, /* gnutls read log */
+ LOG_DEBUG, /* gnutls write log */
+ LOG_DEBUG, /* gnutls io log */
+ LOG_DEBUG, /* gnutls buffers log */
+};
+
+void log_func_gnutls(int level, const char *message) {
+ int ourlevel;
+
+ assert_se(message);
+
+ if (0 <= level && level < (int) ELEMENTSOF(log_level_map))
+ ourlevel = log_level_map[level];
+ else
+ level = LOG_DEBUG;
+
+ log_meta(ourlevel, NULL, 0, NULL, "gnutls: %s", message);
+}
+
+#endif