chore: edit logs messages

This commit is contained in:
Maël Gangloff
2025-10-03 18:14:43 +02:00
parent 400ea42cb2
commit 49242af42f
9 changed files with 81 additions and 62 deletions

View File

@@ -44,9 +44,9 @@ class DomainRefreshController extends AbstractController
$idnDomain = RDAPService::convertToIdn($ldhName); $idnDomain = RDAPService::convertToIdn($ldhName);
$userId = $this->getUser()->getUserIdentifier(); $userId = $this->getUser()->getUserIdentifier();
$this->logger->info('User {username} wants to update the domain name {idnDomain}.', [ $this->logger->info('User wants to update a domain name', [
'username' => $userId, 'username' => $userId,
'idnDomain' => $idnDomain, 'ldhName' => $idnDomain,
]); ]);
/** @var ?Domain $domain */ /** @var ?Domain $domain */
@@ -58,8 +58,8 @@ class DomainRefreshController extends AbstractController
&& !$this->kernel->isDebug() && !$this->kernel->isDebug()
&& true !== filter_var($request->get('forced', false), FILTER_VALIDATE_BOOLEAN) && true !== filter_var($request->get('forced', false), FILTER_VALIDATE_BOOLEAN)
) { ) {
$this->logger->info('It is not necessary to update the information of the domain name {idnDomain} with the RDAP protocol.', [ $this->logger->info('It is not necessary to update the domain name', [
'idnDomain' => $idnDomain, 'ldhName' => $idnDomain,
]); ]);
return $domain; return $domain;

View File

@@ -88,7 +88,7 @@ class RegistrationController extends AbstractController
); );
$signedUrl = (string) $email->getContext()['signedUrl']; $signedUrl = (string) $email->getContext()['signedUrl'];
$this->logger->notice('The validation link for user {username} is {signedUrl}', [ $this->logger->notice('The validation link for this user is generated', [
'username' => $user->getUserIdentifier(), 'username' => $user->getUserIdentifier(),
'signedUrl' => $signedUrl, 'signedUrl' => $signedUrl,
]); ]);
@@ -97,7 +97,7 @@ class RegistrationController extends AbstractController
$this->em->persist($user); $this->em->persist($user);
$this->em->flush(); $this->em->flush();
$this->logger->info('A new user has registered ({username}).', [ $this->logger->info('New user has registered', [
'username' => $user->getUserIdentifier(), 'username' => $user->getUserIdentifier(),
]); ]);
@@ -121,7 +121,7 @@ class RegistrationController extends AbstractController
$this->emailVerifier->handleEmailConfirmation($request, $user); $this->emailVerifier->handleEmailConfirmation($request, $user);
$this->logger->info('User {username} has validated his email address.', [ $this->logger->info('User has validated his email address', [
'username' => $user->getUserIdentifier(), 'username' => $user->getUserIdentifier(),
]); ]);

View File

@@ -71,7 +71,7 @@ final readonly class OrderDomainHandler
return; return;
} }
$this->logger->notice('Watchlist {watchlist} is linked to connector {connector}. A purchase attempt will be made for domain name {ldhName} with provider {provider}.', [ $this->logger->notice('Watchlist is linked to a connector : a purchase attempt will be made for this domain name', [
'watchlist' => $message->watchListToken, 'watchlist' => $message->watchListToken,
'connector' => $connector->getId(), 'connector' => $connector->getId(),
'ldhName' => $message->ldhName, 'ldhName' => $message->ldhName,
@@ -99,7 +99,7 @@ final readonly class OrderDomainHandler
/* /*
* If the purchase was successful, the statistics are updated and a success message is sent to the user. * If the purchase was successful, the statistics are updated and a success message is sent to the user.
*/ */
$this->logger->notice('Watchlist {watchlist} is linked to connector {connector}. A purchase was successfully made for domain {ldhName} with provider {provider}.', [ $this->logger->notice('Watchlist is linked to connector : a purchase was successfully made for this domain name', [
'watchlist' => $message->watchListToken, 'watchlist' => $message->watchListToken,
'connector' => $connector->getId(), 'connector' => $connector->getId(),
'ldhName' => $message->ldhName, 'ldhName' => $message->ldhName,
@@ -118,8 +118,11 @@ final readonly class OrderDomainHandler
* The purchase was not successful (for several possible reasons that we have not determined). * The purchase was not successful (for several possible reasons that we have not determined).
* The user is informed and the exception is raised, which may allow you to try again. * The user is informed and the exception is raised, which may allow you to try again.
*/ */
$this->logger->warning('Unable to complete purchase. An error message is sent to user {username}.', [ $this->logger->warning('Unable to complete purchase : an error message is sent to user', [
'username' => $watchList->getUser()->getUserIdentifier(), 'watchlist' => $message->watchListToken,
'connector' => $connector->getId(),
'ldhName' => $message->ldhName,
'provider' => $connector->getProvider()->value,
]); ]);
$this->statService->incrementStat('stats.domain.purchase.failed'); $this->statService->incrementStat('stats.domain.purchase.failed');

View File

@@ -73,7 +73,7 @@ final readonly class SendDomainEventNotifHandler
/** @var WatchListTrigger $watchListTrigger */ /** @var WatchListTrigger $watchListTrigger */
foreach ($watchListTriggers->getIterator() as $watchListTrigger) { foreach ($watchListTriggers->getIterator() as $watchListTrigger) {
$this->logger->info('Action {event} has been detected on the domain name {ldhName}. A notification is sent to user {username}.', [ $this->logger->info('New action has been detected on this domain name : a notification is sent to user', [
'event' => $event->getAction(), 'event' => $event->getAction(),
'ldhName' => $message->ldhName, 'ldhName' => $message->ldhName,
'username' => $watchList->getUser()->getUserIdentifier(), 'username' => $watchList->getUser()->getUserIdentifier(),

View File

@@ -52,15 +52,15 @@ final readonly class UpdateDomainsFromWatchlistHandler
/** @var WatchList $watchList */ /** @var WatchList $watchList */
$watchList = $this->watchListRepository->findOneBy(['token' => $message->watchListToken]); $watchList = $this->watchListRepository->findOneBy(['token' => $message->watchListToken]);
$this->logger->info('Domain names from Watchlist {token} will be processed.', [ $this->logger->info('Domain names listed in the Watchlist will be updated', [
'token' => $message->watchListToken, 'watchlist' => $message->watchListToken,
]); ]);
/** @var AbstractProvider $connectorProvider */ /** @var AbstractProvider $connectorProvider */
$connectorProvider = $this->getConnectorProvider($watchList); $connectorProvider = $this->getConnectorProvider($watchList);
if ($connectorProvider instanceof CheckDomainProviderInterface) { if ($connectorProvider instanceof CheckDomainProviderInterface) {
$this->logger->notice('Watchlist {watchlist} linked to connector {connector}.', [ $this->logger->notice('Watchlist is linked to a connector', [
'watchlist' => $watchList->getToken(), 'watchlist' => $watchList->getToken(),
'connector' => $watchList->getConnector()->getId(), 'connector' => $watchList->getConnector()->getId(),
]); ]);
@@ -70,7 +70,7 @@ final readonly class UpdateDomainsFromWatchlistHandler
...array_unique(array_map(fn (Domain $d) => $d->getLdhName(), $watchList->getDomains()->toArray())) ...array_unique(array_map(fn (Domain $d) => $d->getLdhName(), $watchList->getDomains()->toArray()))
); );
} catch (\Throwable $exception) { } catch (\Throwable $exception) {
$this->logger->warning('Unable to check domain names availability with connector {connector}.', [ $this->logger->warning('Unable to check domain names availability with this connector', [
'connector' => $watchList->getConnector()->getId(), 'connector' => $watchList->getConnector()->getId(),
]); ]);
@@ -122,7 +122,7 @@ final readonly class UpdateDomainsFromWatchlistHandler
* In case of another unknown error, * In case of another unknown error,
* the owner of the Watchlist is informed that an error occurred in updating the domain name. * the owner of the Watchlist is informed that an error occurred in updating the domain name.
*/ */
$this->logger->error('An update error email is sent to user {username}.', [ $this->logger->error('Update error email is sent to user', [
'username' => $watchList->getUser()->getUserIdentifier(), 'username' => $watchList->getUser()->getUserIdentifier(),
'error' => $e, 'error' => $e,
]); ]);

View File

@@ -59,17 +59,17 @@ readonly class ChatNotificationService
throw new BadRequestHttpException('Unsupported message type'); throw new BadRequestHttpException('Unsupported message type');
} }
$this->logger->info('Chat message sent with {schema} for Watchlist {token}', $this->logger->info('Chat message sent', [
[ 'username' => $watchList->getUser()->getUserIdentifier(),
'scheme' => $webhookScheme->name, 'scheme' => $webhookScheme->name,
'token' => $watchList->getToken(), 'watchlist' => $watchList->getToken(),
]); ]);
} catch (\Throwable $exception) { } catch (\Throwable $exception) {
$this->logger->error('Unable to send a chat message to {scheme} for Watchlist {token}', $this->logger->error('Unable to send a chat message', [
[ 'username' => $watchList->getUser()->getUserIdentifier(),
'scheme' => $webhookScheme->name, 'scheme' => $webhookScheme->name,
'token' => $watchList->getToken(), 'watchlist' => $watchList->getToken(),
]); ]);
throw new BadRequestHttpException($exception->getMessage()); throw new BadRequestHttpException($exception->getMessage());
} }
} }

View File

@@ -143,8 +143,8 @@ class RDAPService
$idnDomain = RDAPService::convertToIdn($fqdn); $idnDomain = RDAPService::convertToIdn($fqdn);
$tld = $this->getTld($idnDomain); $tld = $this->getTld($idnDomain);
$this->logger->info('An update request for domain name {idnDomain} is requested.', [ $this->logger->info('Update request for a domain name is requested', [
'idnDomain' => $idnDomain, 'ldhName' => $idnDomain,
]); ]);
$rdapServer = $this->fetchRdapServer($tld); $rdapServer = $this->fetchRdapServer($tld);
@@ -241,8 +241,8 @@ class RDAPService
private function fetchRdapResponse(RdapServer $rdapServer, string $idnDomain, ?Domain $domain): array private function fetchRdapResponse(RdapServer $rdapServer, string $idnDomain, ?Domain $domain): array
{ {
$rdapServerUrl = $rdapServer->getUrl(); $rdapServerUrl = $rdapServer->getUrl();
$this->logger->notice('An RDAP query to update the domain name {idnDomain} will be made to {server}.', [ $this->logger->notice('An RDAP query to update this domain name will be made', [
'idnDomain' => $idnDomain, 'ldhName' => $idnDomain,
'server' => $rdapServerUrl, 'server' => $rdapServerUrl,
]); ]);
@@ -272,8 +272,8 @@ class RDAPService
|| ($e instanceof TransportExceptionInterface && null !== $response && !in_array('content-length', $response->getHeaders(false)) && 404 === $response->getStatusCode()) || ($e instanceof TransportExceptionInterface && null !== $response && !in_array('content-length', $response->getHeaders(false)) && 404 === $response->getStatusCode())
) { ) {
if (null !== $domain) { if (null !== $domain) {
$this->logger->notice('The domain name {idnDomain} has been deleted from the WHOIS database.', [ $this->logger->notice('Domain name has been deleted from the WHOIS database', [
'idnDomain' => $idnDomain, 'ldhName' => $idnDomain,
]); ]);
$domain->updateTimestamps(); $domain->updateTimestamps();
@@ -302,8 +302,8 @@ class RDAPService
{ {
$domain = new Domain(); $domain = new Domain();
$this->logger->info('The domain name {idnDomain} was not known to this Domain Watchdog instance.', [ $this->logger->info('Domain name was not known to this instance', [
'idnDomain' => $idnDomain, 'ldhName' => $idnDomain,
]); ]);
return $domain->setTld($tld)->setLdhName($idnDomain)->setDeleted(false); return $domain->setTld($tld)->setLdhName($idnDomain)->setDeleted(false);
@@ -330,8 +330,8 @@ class RDAPService
} }
} }
} else { } else {
$this->logger->warning('The domain name {idnDomain} has no WHOIS status.', [ $this->logger->warning('Domain name has no WHOIS status', [
'idnDomain' => $domain->getLdhName(), 'ldhName' => $domain->getLdhName(),
]); ]);
} }
} }
@@ -341,8 +341,8 @@ class RDAPService
if (isset($rdapData['handle'])) { if (isset($rdapData['handle'])) {
$domain->setHandle($rdapData['handle']); $domain->setHandle($rdapData['handle']);
} else { } else {
$this->logger->warning('The domain name {idnDomain} has no handle key.', [ $this->logger->warning('Domain name has no handle key', [
'idnDomain' => $domain->getLdhName(), 'ldhName' => $domain->getLdhName(),
]); ]);
} }
} }
@@ -440,8 +440,8 @@ class RDAPService
} }
} }
} else { } else {
$this->logger->warning('The domain name {idnDomain} has no nameservers.', [ $this->logger->warning('Domain name has no nameservers', [
'idnDomain' => $domain->getLdhName(), 'ldhName' => $domain->getLdhName(),
]); ]);
} }
} }
@@ -533,8 +533,9 @@ class RDAPService
sort($roles); sort($roles);
$rdapEntity['handle'] = 'DW-FAKEHANDLE-'.$domain.'-'.implode(',', $roles); $rdapEntity['handle'] = 'DW-FAKEHANDLE-'.$domain.'-'.implode(',', $roles);
$this->logger->warning('The entity {handle} has no handle key.', [ $this->logger->warning('Entity has no handle key', [
'handle' => $rdapEntity['handle'], 'handle' => $rdapEntity['handle'],
'ldhName' => $domain,
]); ]);
} }
@@ -546,8 +547,9 @@ class RDAPService
if (null === $entity) { if (null === $entity) {
$entity = (new Entity())->setTld($tld); $entity = (new Entity())->setTld($tld);
$this->logger->info('The entity {handle} was not known to this Domain Watchdog instance.', [ $this->logger->info('Entity was not known to this instance', [
'handle' => $rdapEntity['handle'], 'handle' => $rdapEntity['handle'],
'ldhName' => $domain,
]); ]);
} }
@@ -663,12 +665,18 @@ class RDAPService
try { try {
$blob = hex2bin($rdapDsData['digest']); $blob = hex2bin($rdapDsData['digest']);
} catch (\Exception) { } catch (\Exception) {
$this->logger->warning('DNSSEC digest is not a valid hexadecimal value.'); $this->logger->warning('DNSSEC digest is not a valid hexadecimal value', [
'ldhName' => $domain,
'value' => $rdapDsData['digest'],
]);
continue; continue;
} }
if (false === $blob) { if (false === $blob) {
$this->logger->warning('DNSSEC digest is not a valid hexadecimal value.'); $this->logger->warning('DNSSEC digest is not a valid hexadecimal value', [
'ldhName' => $domain,
'value' => $rdapDsData['digest'],
]);
continue; continue;
} }
$dsData->setDigest($blob); $dsData->setDigest($blob);
@@ -688,7 +696,11 @@ class RDAPService
if (array_key_exists($dsData->getDigestType()->value, $digestLengthByte) if (array_key_exists($dsData->getDigestType()->value, $digestLengthByte)
&& strlen($dsData->getDigest()) / 2 !== $digestLengthByte[$dsData->getDigestType()->value]) { && strlen($dsData->getDigest()) / 2 !== $digestLengthByte[$dsData->getDigestType()->value]) {
$this->logger->warning('DNSSEC digest does not have a valid length according to the digest type.'); $this->logger->warning('DNSSEC digest does not have a valid length according to the digest type', [
'ldhName' => $domain,
'value' => $dsData->getDigest(),
'type' => $dsData->getDigestType()->name,
]);
continue; continue;
} }
@@ -696,8 +708,8 @@ class RDAPService
$this->em->persist($dsData); $this->em->persist($dsData);
} }
} else { } else {
$this->logger->warning('The domain name {idnDomain} has no DS record.', [ $this->logger->warning('Domain name has no DS record', [
'idnDomain' => $domain->getLdhName(), 'ldhName' => $domain->getLdhName(),
]); ]);
} }
} }
@@ -712,7 +724,7 @@ class RDAPService
*/ */
public function updateRDAPServersFromIANA(): void public function updateRDAPServersFromIANA(): void
{ {
$this->logger->info('Start of update the RDAP server list from IANA.'); $this->logger->info('Start of update the RDAP server list from IANA');
$dnsRoot = $this->client->request( $dnsRoot = $this->client->request(
'GET', 'https://data.iana.org/rdap/dns.json' 'GET', 'https://data.iana.org/rdap/dns.json'
@@ -768,7 +780,7 @@ class RDAPService
return; return;
} }
$this->logger->info('Start of update the RDAP server list from custom config file.'); $this->logger->info('Start of update the RDAP server list from custom config file');
$this->updateRDAPServers(Yaml::parseFile($fileName)); $this->updateRDAPServers(Yaml::parseFile($fileName));
} }
@@ -780,7 +792,7 @@ class RDAPService
*/ */
public function updateTldListIANA(): void public function updateTldListIANA(): void
{ {
$this->logger->info('Start of retrieval of the list of TLDs according to IANA.'); $this->logger->info('Start of retrieval of the list of TLDs according to IANA');
$tldList = array_map( $tldList = array_map(
fn ($tld) => strtolower($tld), fn ($tld) => strtolower($tld),
explode(PHP_EOL, explode(PHP_EOL,
@@ -801,7 +813,7 @@ class RDAPService
$tldEntity = new Tld(); $tldEntity = new Tld();
$tldEntity->setTld($tld); $tldEntity->setTld($tld);
$this->logger->notice('New TLD detected according to IANA ({tld}).', [ $this->logger->notice('New TLD detected according to IANA', [
'tld' => $tld, 'tld' => $tld,
]); ]);
} }
@@ -830,7 +842,7 @@ class RDAPService
*/ */
public function updateRegistrarListIANA(): void public function updateRegistrarListIANA(): void
{ {
$this->logger->info('Start of retrieval of the list of Registrar IDs according to IANA.'); $this->logger->info('Start of retrieval of the list of Registrar IDs according to IANA');
$registrarList = $this->client->request( $registrarList = $this->client->request(
'GET', 'https://www.iana.org/assignments/registrar-ids/registrar-ids.xml' 'GET', 'https://www.iana.org/assignments/registrar-ids/registrar-ids.xml'
); );
@@ -884,7 +896,7 @@ class RDAPService
*/ */
public function updateGTldListICANN(): void public function updateGTldListICANN(): void
{ {
$this->logger->info('Start of retrieval of the list of gTLDs according to ICANN.'); $this->logger->info('Start of retrieval of the list of gTLDs according to ICANN');
$gTldList = $this->client->request( $gTldList = $this->client->request(
'GET', 'https://www.icann.org/resources/registries/gtlds/v2/gtlds.json' 'GET', 'https://www.icann.org/resources/registries/gtlds/v2/gtlds.json'
@@ -900,7 +912,7 @@ class RDAPService
if (null === $gtTldEntity) { if (null === $gtTldEntity) {
$gtTldEntity = new Tld(); $gtTldEntity = new Tld();
$gtTldEntity->setTld($gTld['gTLD'])->setType(TldType::gTLD); $gtTldEntity->setTld($gTld['gTLD'])->setType(TldType::gTLD);
$this->logger->notice('New gTLD detected according to ICANN ({tld}).', [ $this->logger->notice('New gTLD detected according to ICANN', [
'tld' => $gTld['gTLD'], 'tld' => $gTld['gTLD'],
]); ]);
} }

View File

@@ -47,7 +47,7 @@ readonly class ConnectorCreateProcessor implements ProcessorInterface
$provider = $data->getProvider(); $provider = $data->getProvider();
$this->logger->info('User {username} wants to register a connector from provider {provider}.', [ $this->logger->info('User wants to register a connector', [
'username' => $user->getUserIdentifier(), 'username' => $user->getUserIdentifier(),
'provider' => $provider->value, 'provider' => $provider->value,
]); ]);
@@ -87,7 +87,7 @@ readonly class ConnectorCreateProcessor implements ProcessorInterface
$data->setAuthData($providerClient->authenticate($authData)); $data->setAuthData($providerClient->authenticate($authData));
} }
$this->logger->info('User {username} authentication data with the {provider} provider has been validated.', [ $this->logger->info('User authentication data with this provider has been validated', [
'username' => $user->getUserIdentifier(), 'username' => $user->getUserIdentifier(),
'provider' => $provider->value, 'provider' => $provider->value,
]); ]);

View File

@@ -49,8 +49,9 @@ readonly class WatchListUpdateProcessor implements ProcessorInterface
if ($this->parameterBag->get('limited_features')) { if ($this->parameterBag->get('limited_features')) {
if ($data->getDomains()->count() > (int) $this->parameterBag->get('limit_max_watchlist_domains')) { if ($data->getDomains()->count() > (int) $this->parameterBag->get('limit_max_watchlist_domains')) {
$this->logger->notice('User {username} tried to update a Watchlist. The maximum number of domains has been reached for this Watchlist', [ $this->logger->notice('User tried to update a Watchlist : the maximum number of domains has been reached for this Watchlist', [
'username' => $user->getUserIdentifier(), 'username' => $user->getUserIdentifier(),
'watchlist' => $data->getToken(),
]); ]);
throw new AccessDeniedHttpException('You have exceeded the maximum number of domain names allowed in this Watchlist'); throw new AccessDeniedHttpException('You have exceeded the maximum number of domain names allowed in this Watchlist');
@@ -67,8 +68,9 @@ readonly class WatchListUpdateProcessor implements ProcessorInterface
foreach ($data->getDomains()->getIterator() as $domain) { foreach ($data->getDomains()->getIterator() as $domain) {
if (in_array($domain, $trackedDomains)) { if (in_array($domain, $trackedDomains)) {
$ldhName = $domain->getLdhName(); $ldhName = $domain->getLdhName();
$this->logger->notice('User {username} tried to update a watchlist with domain name {ldhName}. It is forbidden to register the same domain name twice with limited mode', [ $this->logger->notice('User tried to update a watchlist : it is forbidden to register the same domain name twice with limited mode', [
'username' => $user->getUserIdentifier(), 'username' => $user->getUserIdentifier(),
'watchlist' => $data->getToken(),
'ldhName' => $ldhName, 'ldhName' => $ldhName,
]); ]);
@@ -77,8 +79,9 @@ readonly class WatchListUpdateProcessor implements ProcessorInterface
} }
if (null !== $data->getWebhookDsn() && count($data->getWebhookDsn()) > (int) $this->parameterBag->get('limit_max_watchlist_webhooks')) { if (null !== $data->getWebhookDsn() && count($data->getWebhookDsn()) > (int) $this->parameterBag->get('limit_max_watchlist_webhooks')) {
$this->logger->notice('User {username} tried to update a Watchlist. The maximum number of webhooks has been reached.', [ $this->logger->notice('User tried to update a Watchlist : the maximum number of webhooks has been reached', [
'username' => $user->getUserIdentifier(), 'username' => $user->getUserIdentifier(),
'watchlist' => $data->getToken(),
]); ]);
throw new AccessDeniedHttpException('You have exceeded the maximum number of webhooks allowed in this Watchlist'); throw new AccessDeniedHttpException('You have exceeded the maximum number of webhooks allowed in this Watchlist');
@@ -89,7 +92,7 @@ readonly class WatchListUpdateProcessor implements ProcessorInterface
if ($connector = $data->getConnector()) { if ($connector = $data->getConnector()) {
if (!$user->getConnectors()->contains($connector)) { if (!$user->getConnectors()->contains($connector)) {
$this->logger->notice('The Connector ({connector}) does not belong to the user.', [ $this->logger->notice('Connector does not belong to the user', [
'username' => $user->getUserIdentifier(), 'username' => $user->getUserIdentifier(),
'connector' => $connector->getId(), 'connector' => $connector->getId(),
]); ]);
@@ -114,9 +117,10 @@ readonly class WatchListUpdateProcessor implements ProcessorInterface
$supported = $connectorProvider->isSupported(...$data->getDomains()->toArray()); $supported = $connectorProvider->isSupported(...$data->getDomains()->toArray());
if (!$supported) { if (!$supported) {
$this->logger->notice('The Connector ({connector}) does not support all TLDs in this Watchlist', [ $this->logger->notice('Connector does not support all TLDs in this Watchlist', [
'username' => $user->getUserIdentifier(), 'username' => $user->getUserIdentifier(),
'connector' => $connector->getId(), 'connector' => $connector->getId(),
'provider' => $connector->getProvider()->value,
]); ]);
throw new BadRequestHttpException('This connector does not support all TLDs in this Watchlist'); throw new BadRequestHttpException('This connector does not support all TLDs in this Watchlist');