WordPress.org

Making WordPress.org

Changeset 3156


Ignore:
Timestamp:
05/17/2016 12:32:00 AM (3 years ago)
Author:
iandunn
Message:

WordCamp QBO: Log remote requests to aid in troubleshooting.

Location:
sites/trunk/wordcamp.org/public_html/wp-content
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-qbo/wordcamp-qbo.php

    r3119 r3156  
    33 * Plugin Name: WordCamp.org QBO Integration
    44 */
     5
     6use WordCamp\Logger;
    57
    68class WordCamp_QBO {
     
    179181                ),
    180182            ) );
     183            Logger\log( 'remote_request_sync_token', compact( 'response' ) );
    181184
    182185            if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) != 200 )
     
    205208            'body' => $payload,
    206209        ) );
     210        Logger\log( 'remote_request_create_expense', compact( 'payload', 'response' ) );
    207211
    208212        if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) != 200 )
     
    267271            )
    268272        );
     273        Logger\log( 'remote_request', compact( 'args', 'response' ) );
    269274
    270275        if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) {
     
    358363
    359364        $response = wp_remote_post( $qbo_request['url'], $qbo_request['args'] );
     365        Logger\log( 'remote_request', compact( 'qbo_request', 'response' ) );
    360366
    361367        if ( is_wp_error( $response ) ) {
     
    546552        $qbo_request = self::build_qbo_send_invoice_request( $invoice_id );
    547553        $response    = wp_remote_post( $qbo_request['url'], $qbo_request['args'] );
     554        Logger\log( 'remote_request', compact( 'qbo_request', 'response' ) );
    548555
    549556        if ( is_wp_error( $response ) ) {
     
    628635
    629636            if ( $valid_pdf_header && $valid_pdf_footer ) {
     637                $response['body'] = '[valid pdf body removed]'; // because the binary contents aren't printable
     638
    630639                $filename = sprintf(
    631640                    '%sWPCS-invoice-%d.pdf',
     
    644653        }
    645654
     655        Logger\log( 'remote_request', compact( 'qbo_request', 'response' ) ); // call after processing response, because body is removed if pdf is valid
     656
    646657        return $result;
    647658    }
     
    742753
    743754        $response = wp_remote_get( $qbo_request['url'], $qbo_request['args'] );
     755        Logger\log( 'remote_request', compact( 'qbo_request', 'response' ) );
    744756
    745757        if ( is_wp_error( $response ) ) {
     
    848860
    849861        $response = wp_remote_post( $qbo_request['url'], $qbo_request['args'] );
     862        Logger\log( 'remote_request', compact( 'qbo_request', 'response' ) );
    850863
    851864        if ( is_wp_error( $response ) ) {
     
    970983
    971984        $response = wp_remote_get( $qbo_request['url'], $qbo_request['args'] );
     985        Logger\log( 'remote_request', compact( 'qbo_request', 'response' ) );
    972986
    973987        if ( is_wp_error( $response ) ) {
     
    11491163                )
    11501164            ) );
     1165            Logger\log( 'remote_request', compact( 'response' ) );
    11511166
    11521167            if ( is_wp_error( $response ) ) {
Note: See TracChangeset for help on using the changeset viewer.