From ed4df3cee273558871c6db6e854fc17871cb6430 Mon Sep 17 00:00:00 2001 From: Justin Foell <630830+jrfoell@users.noreply.github.com> Date: Fri, 29 Apr 2022 14:18:30 -0500 Subject: [PATCH] Add debug logging to remote_get --- src/WPStrava/API.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/WPStrava/API.php b/src/WPStrava/API.php index 6e632c5..5a478b8 100755 --- a/src/WPStrava/API.php +++ b/src/WPStrava/API.php @@ -151,6 +151,22 @@ class WPStrava_API { } $response = wp_remote_get( $url, $get_args ); + + if ( WPSTRAVA_DEBUG ) { + // phpcs:disable WordPress.PHP.DevelopmentFunctions -- Debug output. + error_log( + print_r( + array( + 'url' => $url, + 'args' => $get_args, + 'response' => $response, + ), + true + ) + ); + // phpcs:enable + } + if ( is_wp_error( $response ) ) { throw WPStrava_Exception::from_wp_error( $response ); }