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);
$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,
'idnDomain' => $idnDomain,
'ldhName' => $idnDomain,
]);
/** @var ?Domain $domain */
@@ -58,8 +58,8 @@ class DomainRefreshController extends AbstractController
&& !$this->kernel->isDebug()
&& 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.', [
'idnDomain' => $idnDomain,
$this->logger->info('It is not necessary to update the domain name', [
'ldhName' => $idnDomain,
]);
return $domain;

View File

@@ -88,7 +88,7 @@ class RegistrationController extends AbstractController
);
$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(),
'signedUrl' => $signedUrl,
]);
@@ -97,7 +97,7 @@ class RegistrationController extends AbstractController
$this->em->persist($user);
$this->em->flush();
$this->logger->info('A new user has registered ({username}).', [
$this->logger->info('New user has registered', [
'username' => $user->getUserIdentifier(),
]);
@@ -121,7 +121,7 @@ class RegistrationController extends AbstractController
$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(),
]);

View File

@@ -71,7 +71,7 @@ final readonly class OrderDomainHandler
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,
'connector' => $connector->getId(),
'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.
*/
$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,
'connector' => $connector->getId(),
'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 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}.', [
'username' => $watchList->getUser()->getUserIdentifier(),
$this->logger->warning('Unable to complete purchase : an error message is sent to user', [
'watchlist' => $message->watchListToken,
'connector' => $connector->getId(),
'ldhName' => $message->ldhName,
'provider' => $connector->getProvider()->value,
]);
$this->statService->incrementStat('stats.domain.purchase.failed');

View File

@@ -73,7 +73,7 @@ final readonly class SendDomainEventNotifHandler
/** @var WatchListTrigger $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(),
'ldhName' => $message->ldhName,
'username' => $watchList->getUser()->getUserIdentifier(),

View File

@@ -52,15 +52,15 @@ final readonly class UpdateDomainsFromWatchlistHandler
/** @var WatchList $watchList */
$watchList = $this->watchListRepository->findOneBy(['token' => $message->watchListToken]);
$this->logger->info('Domain names from Watchlist {token} will be processed.', [
'token' => $message->watchListToken,
$this->logger->info('Domain names listed in the Watchlist will be updated', [
'watchlist' => $message->watchListToken,
]);
/** @var AbstractProvider $connectorProvider */
$connectorProvider = $this->getConnectorProvider($watchList);
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(),
'connector' => $watchList->getConnector()->getId(),
]);
@@ -70,7 +70,7 @@ final readonly class UpdateDomainsFromWatchlistHandler
...array_unique(array_map(fn (Domain $d) => $d->getLdhName(), $watchList->getDomains()->toArray()))
);
} 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(),
]);
@@ -122,7 +122,7 @@ final readonly class UpdateDomainsFromWatchlistHandler
* In case of another unknown error,
* 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(),
'error' => $e,
]);

View File

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

View File

@@ -143,8 +143,8 @@ class RDAPService
$idnDomain = RDAPService::convertToIdn($fqdn);
$tld = $this->getTld($idnDomain);
$this->logger->info('An update request for domain name {idnDomain} is requested.', [
'idnDomain' => $idnDomain,
$this->logger->info('Update request for a domain name is requested', [
'ldhName' => $idnDomain,
]);
$rdapServer = $this->fetchRdapServer($tld);
@@ -241,8 +241,8 @@ class RDAPService
private function fetchRdapResponse(RdapServer $rdapServer, string $idnDomain, ?Domain $domain): array
{
$rdapServerUrl = $rdapServer->getUrl();
$this->logger->notice('An RDAP query to update the domain name {idnDomain} will be made to {server}.', [
'idnDomain' => $idnDomain,
$this->logger->notice('An RDAP query to update this domain name will be made', [
'ldhName' => $idnDomain,
'server' => $rdapServerUrl,
]);
@@ -272,8 +272,8 @@ class RDAPService
|| ($e instanceof TransportExceptionInterface && null !== $response && !in_array('content-length', $response->getHeaders(false)) && 404 === $response->getStatusCode())
) {
if (null !== $domain) {
$this->logger->notice('The domain name {idnDomain} has been deleted from the WHOIS database.', [
'idnDomain' => $idnDomain,
$this->logger->notice('Domain name has been deleted from the WHOIS database', [
'ldhName' => $idnDomain,
]);
$domain->updateTimestamps();
@@ -302,8 +302,8 @@ class RDAPService
{
$domain = new Domain();
$this->logger->info('The domain name {idnDomain} was not known to this Domain Watchdog instance.', [
'idnDomain' => $idnDomain,
$this->logger->info('Domain name was not known to this instance', [
'ldhName' => $idnDomain,
]);
return $domain->setTld($tld)->setLdhName($idnDomain)->setDeleted(false);
@@ -330,8 +330,8 @@ class RDAPService
}
}
} else {
$this->logger->warning('The domain name {idnDomain} has no WHOIS status.', [
'idnDomain' => $domain->getLdhName(),
$this->logger->warning('Domain name has no WHOIS status', [
'ldhName' => $domain->getLdhName(),
]);
}
}
@@ -341,8 +341,8 @@ class RDAPService
if (isset($rdapData['handle'])) {
$domain->setHandle($rdapData['handle']);
} else {
$this->logger->warning('The domain name {idnDomain} has no handle key.', [
'idnDomain' => $domain->getLdhName(),
$this->logger->warning('Domain name has no handle key', [
'ldhName' => $domain->getLdhName(),
]);
}
}
@@ -440,8 +440,8 @@ class RDAPService
}
}
} else {
$this->logger->warning('The domain name {idnDomain} has no nameservers.', [
'idnDomain' => $domain->getLdhName(),
$this->logger->warning('Domain name has no nameservers', [
'ldhName' => $domain->getLdhName(),
]);
}
}
@@ -533,8 +533,9 @@ class RDAPService
sort($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'],
'ldhName' => $domain,
]);
}
@@ -546,8 +547,9 @@ class RDAPService
if (null === $entity) {
$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'],
'ldhName' => $domain,
]);
}
@@ -663,12 +665,18 @@ class RDAPService
try {
$blob = hex2bin($rdapDsData['digest']);
} 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;
}
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;
}
$dsData->setDigest($blob);
@@ -688,7 +696,11 @@ class RDAPService
if (array_key_exists($dsData->getDigestType()->value, $digestLengthByte)
&& 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;
}
@@ -696,8 +708,8 @@ class RDAPService
$this->em->persist($dsData);
}
} else {
$this->logger->warning('The domain name {idnDomain} has no DS record.', [
'idnDomain' => $domain->getLdhName(),
$this->logger->warning('Domain name has no DS record', [
'ldhName' => $domain->getLdhName(),
]);
}
}
@@ -712,7 +724,7 @@ class RDAPService
*/
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(
'GET', 'https://data.iana.org/rdap/dns.json'
@@ -768,7 +780,7 @@ class RDAPService
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));
}
@@ -780,7 +792,7 @@ class RDAPService
*/
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(
fn ($tld) => strtolower($tld),
explode(PHP_EOL,
@@ -801,7 +813,7 @@ class RDAPService
$tldEntity = new 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,
]);
}
@@ -830,7 +842,7 @@ class RDAPService
*/
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(
'GET', 'https://www.iana.org/assignments/registrar-ids/registrar-ids.xml'
);
@@ -884,7 +896,7 @@ class RDAPService
*/
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(
'GET', 'https://www.icann.org/resources/registries/gtlds/v2/gtlds.json'
@@ -900,7 +912,7 @@ class RDAPService
if (null === $gtTldEntity) {
$gtTldEntity = new Tld();
$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'],
]);
}

View File

@@ -47,7 +47,7 @@ readonly class ConnectorCreateProcessor implements ProcessorInterface
$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(),
'provider' => $provider->value,
]);
@@ -87,7 +87,7 @@ readonly class ConnectorCreateProcessor implements ProcessorInterface
$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(),
'provider' => $provider->value,
]);

View File

@@ -49,8 +49,9 @@ readonly class WatchListUpdateProcessor implements ProcessorInterface
if ($this->parameterBag->get('limited_features')) {
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(),
'watchlist' => $data->getToken(),
]);
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) {
if (in_array($domain, $trackedDomains)) {
$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(),
'watchlist' => $data->getToken(),
'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')) {
$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(),
'watchlist' => $data->getToken(),
]);
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 (!$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(),
'connector' => $connector->getId(),
]);
@@ -114,9 +117,10 @@ readonly class WatchListUpdateProcessor implements ProcessorInterface
$supported = $connectorProvider->isSupported(...$data->getDomains()->toArray());
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(),
'connector' => $connector->getId(),
'provider' => $connector->getProvider()->value,
]);
throw new BadRequestHttpException('This connector does not support all TLDs in this Watchlist');