Skip to content

Commit

Permalink
Merge pull request #489 from MinnPost/debug-log-parameters-sent-to-sa…
Browse files Browse the repository at this point in the history
…lesforce

When creating a debug message for a Salesforce API call, include any parameters the plugin is sending to Salesforce. Thanks to WordPress forum user @MetricMedia.
  • Loading branch information
jonathanstegall authored Aug 9, 2022
2 parents dc6472a + 07d5d7a commit fe9dc71
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion classes/class-object-sync-sf-salesforce.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ protected function api_http_request( $path, $params, $method, $options = array()
$result['is_redo'] = false;
}

// it would be very unfortunate to ever have to do this in a production site.
// in debug mode, this will log what we know about a Salesforce API call.
if ( true === $this->debug ) {
// create log entry for the api call if debug is true.
$status = 'debug';
Expand Down Expand Up @@ -447,6 +447,13 @@ protected function api_http_request( $path, $params, $method, $options = array()
'<code>' . esc_html( $soql ) . '</code>'
);
}
if ( ! empty( $params ) ) {
$body .= sprintf(
// translators: placeholder is: 1) the params sent to Salesforce.
'<h3>' . esc_html__( 'Parameters sent to the Salesforce API', 'object-sync-for-salesforce' ) . '</h3> <div>%1$s</div>',
print_r( $params, true ) // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_print_r
);
}
$body .= sprintf(
// translators: placeholder is: 1) the API call's result.
'<h3>' . esc_html__( 'API result from Salesforce', 'object-sync-for-salesforce' ) . '</h3> <div>%1$s</div>',
Expand Down

0 comments on commit fe9dc71

Please sign in to comment.