Skip to content

Commit

Permalink
option verboseUserFunc added for advaced verbosity setting
Browse files Browse the repository at this point in the history
  • Loading branch information
dennydanek committed Mar 26, 2020
1 parent 05ccb31 commit d10a2cb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions php/base/Exchange.php
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,7 @@ public function __construct($options = array()) {
'511' => 'AuthenticationError',
);
$this->verbose = false;
$this->verboseUserFunc = 'print_r';
$this->apiKey = '';
$this->secret = '';
$this->password = '';
Expand Down Expand Up @@ -1292,8 +1293,8 @@ public function fetch($url, $method = 'GET', $headers = null, $body = null) {
}

if ($this->verbose) {
print_r("\nRequest:\n");
print_r(array($method, $url, $verbose_headers, $body));
call_user_func($this->verboseUserFunc, "\nRequest:\n");
call_user_func($this->verboseUserFunc, array('method' => $method, 'url' => $url, 'verbose_headers' => $verbose_headers, 'body' => $body));
}

// we probably only need to set it once on startup
Expand Down Expand Up @@ -1375,8 +1376,8 @@ function ($curl, $header) use (&$response_headers, &$http_status_text) {
$http_status_code = curl_getinfo($this->curl, CURLINFO_HTTP_CODE);

if ($this->verbose) {
print_r("\nResponse:\n");
print_r(array($method, $url, $http_status_code, $curl_error, $response_headers, $result));
call_user_func($this->verboseUserFunc, "\nResponse:\n");
call_user_func($this->verboseUserFunc, array('method' => $method, 'url' => $url, 'http_status_code' => $http_status_code, 'curl_error' => $curl_error, 'response_headers' => $response_headers, 'result' => $result));
}

$this->handle_errors($http_status_code, $http_status_text, $url, $method, $response_headers, $result ? $result : null, $json_response, $headers, $body);
Expand Down

0 comments on commit d10a2cb

Please sign in to comment.