Skip to content

Commit

Permalink
Added option to log responses
Browse files Browse the repository at this point in the history
  • Loading branch information
chinleung committed Mar 12, 2021
1 parent 6c58000 commit da19c49
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
13 changes: 13 additions & 0 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@
'pin' => env('CONVERGE_USER_PIN'),
],

/*
|--------------------------------------------------------------------------
| Debugging
|--------------------------------------------------------------------------
|
| Indicates if the responses of Converge should be logged.
|
*/

'debug' => [
'log' => env('CONVERGE_LOG', false),
],

/*
|--------------------------------------------------------------------------
| Demo Mode
Expand Down
6 changes: 6 additions & 0 deletions src/Http/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace ChinLeung\Converge\Http;

use Illuminate\Http\Client\Response as ClientResponse;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use SimpleXMLElement;

Expand Down Expand Up @@ -30,6 +31,11 @@ class Response
public function __construct(ClientResponse $response)
{
$this->response = $response;

if (config('converge.debug.log')) {
Log::debug(sprintf('Converge Response :: [%s]', $response->body()));
}

$this->xml = simplexml_load_string($response->body());

$this->throwException();
Expand Down

0 comments on commit da19c49

Please sign in to comment.