add contexts to log items

This commit is contained in:
Daniel Seifert 2022-07-15 16:12:30 +02:00
parent fe60f1102d
commit 73694a1c57
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
2 changed files with 5 additions and 4 deletions

View File

@ -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);
}

View File

@ -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;