[evolution-ews/gnome-41] Misc: Correct response print in debug output



commit b549062ab999d689d314e45491d56b2fa0ce37e5
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jan 17 09:41:50 2022 +0100

    Misc: Correct response print in debug output
    
    This regressed in commit ec6d9dd8cc50fef3a7bcc0a25960700ca6658b63,
    which did not print the server responses with the EWS_DEBUG=2.

 src/EWS/common/e-ews-connection.c   | 5 +++--
 src/EWS/common/e-ews-debug.c        | 6 +++++-
 src/EWS/common/e-ews-notification.c | 6 +++---
 3 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/src/EWS/common/e-ews-connection.c b/src/EWS/common/e-ews-connection.c
index ea0ccca9..621826ea 100644
--- a/src/EWS/common/e-ews-connection.c
+++ b/src/EWS/common/e-ews-connection.c
@@ -1015,11 +1015,12 @@ ews_response_cb (SoupSession *session,
         * Logging framework also */
 
        log_level = e_ews_debug_get_log_level ();
-       if (log_level == 1) {
+       if (log_level >= 1 && log_level < 4) {
                /* This will dump only the headers, since we stole the body.
                 * And only if EWS_DEBUG=1, since higher levels will have dumped
                 * it directly from libsoup anyway. */
-               e_ews_debug_dump_raw_soup_response (msg);
+               if (log_level == 1)
+                       e_ews_debug_dump_raw_soup_response (msg);
                /* And this will dump the body... */
                e_soap_response_dump_response (response, stdout);
        }
diff --git a/src/EWS/common/e-ews-debug.c b/src/EWS/common/e-ews-debug.c
index eb655428..010a9662 100644
--- a/src/EWS/common/e-ews-debug.c
+++ b/src/EWS/common/e-ews-debug.c
@@ -92,7 +92,11 @@ print_header (const gchar *name,
              const gchar *value,
              gpointer user_data)
 {
-       fprintf (user_data, "%s: %s\n", name, value);
+       gchar *header = g_strconcat (name, ": ", value, NULL);
+
+       fprintf (user_data, "%s\n", e_ews_debug_redact_headers ('<', header));
+
+       g_free (header);
 }
 
 static void
diff --git a/src/EWS/common/e-ews-notification.c b/src/EWS/common/e-ews-notification.c
index c87f248f..f793f9da 100644
--- a/src/EWS/common/e-ews-notification.c
+++ b/src/EWS/common/e-ews-notification.c
@@ -361,7 +361,7 @@ e_ews_notification_subscribe_folder_sync (EEwsNotification *notification,
                return FALSE;
        }
 
-       if (log_level >= 1 && log_level != 2 && log_level < 4) {
+       if (log_level >= 1 && log_level < 4) {
                e_ews_debug_dump_raw_soup_request (SOUP_MESSAGE (msg));
        }
 
@@ -385,7 +385,7 @@ e_ews_notification_subscribe_folder_sync (EEwsNotification *notification,
 
        response = e_soap_response_new_from_xmldoc (doc);
 
-       if (log_level >= 1 && log_level != 2 && log_level < 4) {
+       if (log_level >= 1 && log_level < 4) {
                e_ews_debug_dump_raw_soup_response (SOUP_MESSAGE (msg));
        }
        g_object_unref (msg);
@@ -745,7 +745,7 @@ ews_notification_soup_got_chunk (SoupMessage *msg,
                if (response == NULL)
                        break;
 
-               if (log_level >= 1 && log_level != 2 && log_level < 4) {
+               if (log_level >= 1 && log_level < 4) {
                        e_ews_debug_dump_raw_soup_response (msg);
                        e_soap_response_dump_response (response, stdout);
                }


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