1 /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 * GIO - GLib Input, Output and Streaming Library
5 * Copyright 2009 Red Hat, Inc
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, see
19 * <http://www.gnu.org/licenses/>.
21 * In addition, when the library is used with OpenSSL, a special
22 * exception applies. Refer to the LICENSE_EXCEPTION file for details.
29 #include <glib/gprintf.h>
34 void g_tls_log (GLogLevelFlags level,
43 gchar *message = NULL;
48 va_start (args, format);
49 ret = g_vasprintf (&message, format, args);
55 if (conn && G_IS_TLS_CONNECTION (conn)) {
56 if (G_IS_TLS_CLIENT_CONNECTION (conn))
57 header = g_strdup_printf ("CLIENT[%p]: ", conn);
58 else if (G_IS_TLS_SERVER_CONNECTION (conn))
59 header = g_strdup_printf ("SERVER[%p]: ", conn);
61 g_assert_not_reached ();
63 header = g_strdup ("");
66 thread = g_strdup_printf ("%p", g_thread_self ());
67 g_log_structured (G_LOG_DOMAIN, level,
68 "GLIB_NET_THREAD", thread,
72 "MESSAGE", "%s%s", header, message);