diff --git a/src/Client.php b/src/Client.php index 6e9055b..af39b9d 100644 --- a/src/Client.php +++ b/src/Client.php @@ -68,7 +68,7 @@ class Client { $options['headers']['Authorization'] = 'Bearer '.$this->accessToken; - $this->getLoggerHandler()->getLogger()->debug('request '.$url, $options); + $this->getLoggerHandler()->getLogger()->debug('linkmobility request: '.$url, $options); $response = $this->requestClient->request( $method, @@ -78,7 +78,8 @@ class Client if ($response->getStatusCode() != 200) { $message = sprintf(ExceptionMessages::NOK_REQUEST_RETURN, $url, $response->getStatusCode()); - $this->getLoggerHandler()->getLogger()->error($message); + $response->getBody()->rewind(); + $this->getLoggerHandler()->getLogger()->error($message, [$response->getBody()->getContents()]); throw new ApiException($message); } diff --git a/src/RecipientsList/RecipientsList.php b/src/RecipientsList/RecipientsList.php index afa31c3..e6fcfa6 100644 --- a/src/RecipientsList/RecipientsList.php +++ b/src/RecipientsList/RecipientsList.php @@ -76,9 +76,9 @@ class RecipientsList implements RecipientsListInterface, Iterator $this->recipients[ md5(serialize($recipient)) ] = $recipient; } catch (NumberParseException $e) { - $this->client->getLoggerHandler()->getLogger()->info($e->getMessage()); + $this->client->getLoggerHandler()->getLogger()->info($e->getMessage(), [$recipient]); } catch (RecipientException $e) { - $this->client->getLoggerHandler()->getLogger()->info($e->getMessage()); + $this->client->getLoggerHandler()->getLogger()->info($e->getMessage(), [$recipient]); } return $this;