Skip to content

Commit

Permalink
Less logging when not debugging, issue 308
Browse files Browse the repository at this point in the history
  • Loading branch information
adixon committed Oct 27, 2020
1 parent e6c3e23 commit c2cea60
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions CRM/Iats/iATSServiceRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,17 +220,20 @@ public function request($credentials, $request_params) {
}
}
catch (SoapFault $exception) {
// always log soap faults to the CiviCRM error log
CRM_Core_Error::debug_var('SoapFault Exception', $exception);
// always log soap fault codes to the CiviCRM error log
CRM_Core_Error::debug_var('SoapFault Code',$exception->faultcode);
CRM_Core_Error::debug_var('SoapFault String',$exception->faultstring);
if (!empty($this->options['debug']) && !empty($soapClient)) {
$response_log = "\n HEADER:\n";
$response_log .= $soapClient->__getLastResponseHeaders();
$response_log .= "\n BODY:\n";
$response_log .= $soapClient->__getLastResponse();
$response_log .= "\n BODYEND:\n";
CRM_Core_Error::debug_var('Raw Response', $response_log);
// extra logging if debugging
if (!empty($this->options['debug'])) {
CRM_Core_Error::debug_var('SoapFault Exception', $exception);
if (!empty($soapClient)) {
$response_log = "\n HEADER:\n";
$response_log .= $soapClient->__getLastResponseHeaders();
$response_log .= "\n BODY:\n";
$response_log .= $soapClient->__getLastResponse();
$response_log .= "\n BODYEND:\n";
CRM_Core_Error::debug_var('Raw Response', $response_log);
}
}
return FALSE;
}
Expand Down

0 comments on commit c2cea60

Please sign in to comment.