Used PSR3 logger preprocessor format instead of sprintf when possible

This commit is contained in:
Alejandro Celaya
2019-12-27 16:15:14 +01:00
parent 25243a10ec
commit 562b0a0868
2 changed files with 15 additions and 14 deletions

View File

@@ -46,7 +46,9 @@ class LocateShortUrlVisit
/** @var Visit|null $visit */
$visit = $this->em->find(Visit::class, $visitId);
if ($visit === null) {
$this->logger->warning(sprintf('Tried to locate visit with id "%s", but it does not exist.', $visitId));
$this->logger->warning('Tried to locate visit with id "{visitId}", but it does not exist.', [
'visitId' => $visitId,
]);
return;
}
@@ -57,11 +59,8 @@ class LocateShortUrlVisit
} catch (GeolocationDbUpdateFailedException $e) {
if (! $e->olderDbExists()) {
$this->logger->error(
sprintf(
'GeoLite2 database download failed. It is not possible to locate visit with id %s. {e}',
$visitId
),
['e' => $e]
'GeoLite2 database download failed. It is not possible to locate visit with id {visitId}. {e}',
['e' => $e, 'visitId' => $visitId]
);
return;
}
@@ -75,8 +74,8 @@ class LocateShortUrlVisit
: Location::emptyInstance();
} catch (WrongIpException $e) {
$this->logger->warning(
sprintf('Tried to locate visit with id "%s", but its address seems to be wrong. {e}', $visitId),
['e' => $e]
'Tried to locate visit with id "{visitId}", but its address seems to be wrong. {e}',
['e' => $e, 'visitId' => $visitId]
);
return;
}