[glib-networking/mcatanzaro/logging] Avoid non-debug logs in release code



commit 507b74ed7d5376d6e21e24ca7c660c83e72936e8
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Fri Nov 29 16:03:01 2019 -0600

    Avoid non-debug logs in release code
    
    We don't want to print warnings each time we have a certificate
    verification failure, since that's not an unexpected event.

 tls/base/gtlsconnection-base.c | 2 +-
 tls/base/gtlslog.h             | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index c72c3ec..5939840 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -1264,7 +1264,7 @@ verify_peer_certificate (GTlsConnectionBase *tls,
                                              NULL, &error);
       if (error)
         {
-          g_tls_log_warning (tls, "failure verifying certificate chain: %s", error->message);
+          g_tls_log_debug (tls, "failure verifying certificate chain: %s", error->message);
           g_assert (errors != 0);
           g_clear_error (&error);
         }
diff --git a/tls/base/gtlslog.h b/tls/base/gtlslog.h
index ffb8b36..5501756 100644
--- a/tls/base/gtlslog.h
+++ b/tls/base/gtlslog.h
@@ -40,6 +40,9 @@ void g_tls_log (GLogLevelFlags  level,
 #define g_tls_log_debug(_conn, _format, _args...)   g_tls_log (G_LOG_LEVEL_DEBUG, _conn, \
                                                                __FILE__, G_STRINGIFY (__LINE__), \
                                                                G_STRFUNC, _format, ## _args)
+
+/* The following functions are for local debugging only. */
+#if 0
 #define g_tls_log_info(_conn, _format, _args...)    g_tls_log (G_LOG_LEVEL_INFO, _conn, \
                                                                __FILE__, G_STRINGIFY (__LINE__), \
                                                                G_STRFUNC, _format, ## _args)
@@ -49,6 +52,7 @@ void g_tls_log (GLogLevelFlags  level,
 #define g_tls_log_error(_conn, _format, _args...)   g_tls_log (G_LOG_LEVEL_ERROR, _conn, \
                                                                __FILE__, G_STRINGIFY (__LINE__), \
                                                                G_STRFUNC, _format, ## _args)
+#endif
 
 G_END_DECLS
 


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