From ca21acd4462553e17b2d60e59c0685e46bc266b5 Mon Sep 17 00:00:00 2001 From: Cerdic <cedric@yterium.com> Date: Tue, 11 Jan 2022 12:05:37 +0100 Subject: [PATCH] Ameliorer les logs de recuperer_url() pour faciliter le debug --- ecrire/inc/distant.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ecrire/inc/distant.php b/ecrire/inc/distant.php index a26ec61a64..c53ccf1007 100644 --- a/ecrire/inc/distant.php +++ b/ecrire/inc/distant.php @@ -451,6 +451,7 @@ function recuperer_url($url, $options = []) { $options['taille_max'] = $copy ? _COPIE_LOCALE_MAX_SIZE : _INC_DISTANT_MAX_SIZE; } + spip_log("recuperer_url " . $options['methode']. " sur $url", 'distant' . _LOG_DEBUG); // Ajout des en-têtes spécifiques si besoin $formatted_data = ''; @@ -557,7 +558,7 @@ function recuperer_url($url, $options = []) { $options['datas'] = ''; } } - spip_log("recuperer_url recommence " . $options['methode']. " sur $url", 'distant'); + spip_log("recuperer_url recommence " . $options['methode']. " sur $url", 'distant' . _LOG_DEBUG); return recuperer_url($url, $options); } elseif ($res['status'] !== 200) { @@ -577,6 +578,7 @@ function recuperer_url($url, $options = []) { // on ne veut que les entetes if (!$options['taille_max'] or $options['methode'] == 'HEAD' or $result['status'] == '304') { + spip_log("RESULTAT recuperer_url " . $options['methode']. " sur $url : " . json_encode($result), 'distant' . _LOG_DEBUG); return $result; } @@ -620,6 +622,10 @@ function recuperer_url($url, $options = []) { $result['page'] = transcoder_page($result['page'], $result['headers']); } + $trace = json_decode(json_encode($result), true); + $trace['page'] = '...'; + spip_log("RESULTAT recuperer_url " . $options['methode']. " sur $url : " . json_encode($trace), 'distant' . _LOG_DEBUG); + return $result; } -- GitLab