@@ 295-316 (lines=22) @@ | ||
292 | } |
|
293 | ||
294 | // it would be very unfortunate to ever have to do this in a production site |
|
295 | if ( 1 === (int) $this->debug ) { |
|
296 | // create log entry for the api call if debug is true |
|
297 | $status = 'debug'; |
|
298 | if ( isset( $this->logging ) ) { |
|
299 | $logging = $this->logging; |
|
300 | } elseif ( class_exists( 'Object_Sync_Sf_Logging' ) ) { |
|
301 | $logging = new Object_Sync_Sf_Logging( $this->wpdb, $this->version ); |
|
302 | } |
|
303 | ||
304 | // translators: placeholder is the URL of the Salesforce API request |
|
305 | $title = sprintf( esc_html__( 'Debug: on Salesforce API HTTP Request to URL: %1$s.', 'object-sync-for-salesforce' ), |
|
306 | esc_url( $url ) |
|
307 | ); |
|
308 | ||
309 | $logging->setup( |
|
310 | $title, |
|
311 | print_r( $result, true ), // log the result because we are debugging the whole api call |
|
312 | 0, |
|
313 | 0, |
|
314 | $status |
|
315 | ); |
|
316 | } |
|
317 | ||
318 | return $result; |
|
319 | } |
|
@@ 454-475 (lines=22) @@ | ||
451 | 0, |
|
452 | $status |
|
453 | ); |
|
454 | } else { |
|
455 | // create log entry for failed curl |
|
456 | $status = 'error'; |
|
457 | if ( isset( $this->logging ) ) { |
|
458 | $logging = $this->logging; |
|
459 | } elseif ( class_exists( 'Object_Sync_Sf_Logging' ) ) { |
|
460 | $logging = new Object_Sync_Sf_Logging( $this->wpdb, $this->version ); |
|
461 | } |
|
462 | ||
463 | // translators: placeholder is the server code returned by Salesforce |
|
464 | $title = sprintf( esc_html__( 'Error: %1$s: on Salesforce http request', 'object-sync-for-salesforce' ), |
|
465 | absint( $code ) |
|
466 | ); |
|
467 | ||
468 | $logging->setup( |
|
469 | $title, |
|
470 | print_r( $data, true ), // log the result because we are debugging the whole api call |
|
471 | 0, |
|
472 | 0, |
|
473 | $status |
|
474 | ); |
|
475 | } // End if(). |
|
476 | } // End if(). |
|
477 | ||
478 | curl_close( $curl ); |