mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 09:08:09 +08:00
Log request body and wp error
This commit is contained in:
parent
1eb2087bfb
commit
ba66cf6c2e
1 changed files with 15 additions and 10 deletions
|
@ -43,9 +43,11 @@ trait RequestTrait {
|
|||
if ( isset( $args['method'] ) ) {
|
||||
$this->logger->log( 'info', 'Method: ' . wc_print_r( $args['method'], true ) );
|
||||
}
|
||||
if ( isset( $args['headers']['body'] ) ) {
|
||||
$this->logger->log( 'info', 'Request Body: ' . wc_print_r( $args['headers']['body'], true ) );
|
||||
if ( isset( $args['body'] ) ) {
|
||||
$this->logger->log( 'info', 'Request Body: ' . wc_print_r( $args['body'], true ) );
|
||||
}
|
||||
|
||||
if ( ! is_wp_error( $response ) ) {
|
||||
if ( isset( $response['headers']->getAll()['paypal-debug-id'] ) ) {
|
||||
$this->logger->log( 'info', 'Response Debug ID: ' . wc_print_r( $response['headers']->getAll()['paypal-debug-id'], true ) );
|
||||
}
|
||||
|
@ -55,6 +57,9 @@ trait RequestTrait {
|
|||
if ( isset( $response['body'] ) ) {
|
||||
$this->logger->log( 'info', 'Response Body: ' . wc_print_r( $response['body'], true ) );
|
||||
}
|
||||
} else {
|
||||
$this->logger->log( 'error', 'WP Error: ' . wc_print_r( $response->get_error_code() . ' ' . $response->get_error_message(), true ) );
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue