add contexts to log items

Cette révision appartient à :
Daniel Seifert 2022-07-15 16:12:30 +02:00
Parent fe60f1102d
révision 73694a1c57
Signé par: DanielS
ID de la clé GPG: 8A7C4C6ED1915C6F
2 fichiers modifiés avec 5 ajouts et 4 suppressions

Voir le fichier

@ -68,7 +68,7 @@ class Client
{ {
$options['headers']['Authorization'] = 'Bearer '.$this->accessToken; $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( $response = $this->requestClient->request(
$method, $method,
@ -78,7 +78,8 @@ class Client
if ($response->getStatusCode() != 200) { if ($response->getStatusCode() != 200) {
$message = sprintf(ExceptionMessages::NOK_REQUEST_RETURN, $url, $response->getStatusCode()); $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); throw new ApiException($message);
} }

Voir le fichier

@ -76,9 +76,9 @@ class RecipientsList implements RecipientsListInterface, Iterator
$this->recipients[ md5(serialize($recipient)) ] = $recipient; $this->recipients[ md5(serialize($recipient)) ] = $recipient;
} catch (NumberParseException $e) { } catch (NumberParseException $e) {
$this->client->getLoggerHandler()->getLogger()->info($e->getMessage()); $this->client->getLoggerHandler()->getLogger()->info($e->getMessage(), [$recipient]);
} catch (RecipientException $e) { } catch (RecipientException $e) {
$this->client->getLoggerHandler()->getLogger()->info($e->getMessage()); $this->client->getLoggerHandler()->getLogger()->info($e->getMessage(), [$recipient]);
} }
return $this; return $this;