From 9c025861d93ea7d32c355252045c24b004d70e4e Mon Sep 17 00:00:00 2001 From: xjm <xjm@65776.no-reply.drupal.org> Date: Fri, 10 Nov 2023 09:17:08 -0600 Subject: [PATCH] Issue #3381078 by mfb, smustgrave, xjm, quietone, andypost: Demote routine log events from "notice" to "info" --- core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php | 2 +- core/modules/comment/src/CommentForm.php | 2 +- core/modules/comment/src/Form/DeleteForm.php | 2 +- core/modules/contact/src/MailHandler.php | 4 ++-- core/modules/contact/tests/src/Unit/MailHandlerTest.php | 2 +- core/modules/search/src/Controller/SearchController.php | 2 +- core/modules/taxonomy/src/TermForm.php | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php b/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php index e0f6d0896be6..dab1c6d14326 100644 --- a/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php +++ b/core/lib/Drupal/Core/Action/Plugin/Action/EmailAction.php @@ -143,7 +143,7 @@ public function execute($entity = NULL) { $message = $this->mailManager->mail('system', 'action_send_email', $recipient, $langcode, $params); // Error logging is handled by \Drupal\Core\Mail\MailManager::mail(). if ($message['result']) { - $this->logger->notice('Sent email to %recipient', ['%recipient' => $recipient]); + $this->logger->info('Sent email to %recipient', ['%recipient' => $recipient]); } } diff --git a/core/modules/comment/src/CommentForm.php b/core/modules/comment/src/CommentForm.php index ba4047d45fb7..7bd37d3b118c 100644 --- a/core/modules/comment/src/CommentForm.php +++ b/core/modules/comment/src/CommentForm.php @@ -381,7 +381,7 @@ public function save(array $form, FormStateInterface $form_state) { $form_state->setValue('cid', $comment->id()); // Add a log entry. - $logger->notice('Comment posted: %subject.', [ + $logger->info('Comment posted: %subject.', [ '%subject' => $comment->getSubject(), 'link' => Link::fromTextAndUrl(t('View'), $comment->toUrl()->setOption('fragment', 'comment-' . $comment->id()))->toString(), ]); diff --git a/core/modules/comment/src/Form/DeleteForm.php b/core/modules/comment/src/Form/DeleteForm.php index 84ff1f999d50..5be6d10aa165 100644 --- a/core/modules/comment/src/Form/DeleteForm.php +++ b/core/modules/comment/src/Form/DeleteForm.php @@ -44,7 +44,7 @@ protected function getDeletionMessage() { * {@inheritdoc} */ public function logDeletionMessage() { - $this->logger('comment')->notice('Deleted comment @cid and its replies.', ['@cid' => $this->entity->id()]); + $this->logger('comment')->info('Deleted comment @cid and its replies.', ['@cid' => $this->entity->id()]); } } diff --git a/core/modules/contact/src/MailHandler.php b/core/modules/contact/src/MailHandler.php index eb1860d82d10..9e8f323e98c7 100644 --- a/core/modules/contact/src/MailHandler.php +++ b/core/modules/contact/src/MailHandler.php @@ -133,14 +133,14 @@ public function sendMailMessages(MessageInterface $message, AccountInterface $se } if (!$message->isPersonal()) { - $this->logger->notice('%sender-name (@sender-from) sent an email regarding %contact_form.', [ + $this->logger->info('%sender-name (@sender-from) sent an email regarding %contact_form.', [ '%sender-name' => $sender_cloned->getAccountName(), '@sender-from' => $sender_cloned->getEmail() ?? '', '%contact_form' => $contact_form->label(), ]); } else { - $this->logger->notice('%sender-name (@sender-from) sent %recipient-name an email.', [ + $this->logger->info('%sender-name (@sender-from) sent %recipient-name an email.', [ '%sender-name' => $sender_cloned->getAccountName(), '@sender-from' => $sender_cloned->getEmail(), '%recipient-name' => $message->getPersonalRecipient()->getAccountName(), diff --git a/core/modules/contact/tests/src/Unit/MailHandlerTest.php b/core/modules/contact/tests/src/Unit/MailHandlerTest.php index 1b3d34784bed..50b32628d8b2 100644 --- a/core/modules/contact/tests/src/Unit/MailHandlerTest.php +++ b/core/modules/contact/tests/src/Unit/MailHandlerTest.php @@ -135,7 +135,7 @@ public function testInvalidRecipient() { */ public function testSendMailMessages(MessageInterface $message, AccountInterface $sender, $results) { $this->logger->expects($this->once()) - ->method('notice'); + ->method('info'); $this->mailManager->expects($this->any()) ->method('mail') ->willReturnCallback( diff --git a/core/modules/search/src/Controller/SearchController.php b/core/modules/search/src/Controller/SearchController.php index b10c3f921803..c44110f84db2 100644 --- a/core/modules/search/src/Controller/SearchController.php +++ b/core/modules/search/src/Controller/SearchController.php @@ -95,7 +95,7 @@ public function view(Request $request, SearchPageInterface $entity) { if ($plugin->isSearchExecutable()) { // Log the search. if ($this->config('search.settings')->get('logging')) { - $this->logger->notice('Searched %type for %keys.', ['%keys' => $keys, '%type' => $entity->label()]); + $this->logger->info('Searched %type for %keys.', ['%keys' => $keys, '%type' => $entity->label()]); } // Collect the search results. diff --git a/core/modules/taxonomy/src/TermForm.php b/core/modules/taxonomy/src/TermForm.php index 061262f8e5ce..3bf3f204130b 100644 --- a/core/modules/taxonomy/src/TermForm.php +++ b/core/modules/taxonomy/src/TermForm.php @@ -201,12 +201,12 @@ public function save(array $form, FormStateInterface $form_state) { switch ($result) { case SAVED_NEW: $this->messenger()->addStatus($this->t('Created new term %term.', ['%term' => $view_link])); - $this->logger('taxonomy')->notice('Created new term %term.', ['%term' => $term->getName(), 'link' => $edit_link]); + $this->logger('taxonomy')->info('Created new term %term.', ['%term' => $term->getName(), 'link' => $edit_link]); break; case SAVED_UPDATED: $this->messenger()->addStatus($this->t('Updated term %term.', ['%term' => $view_link])); - $this->logger('taxonomy')->notice('Updated term %term.', ['%term' => $term->getName(), 'link' => $edit_link]); + $this->logger('taxonomy')->info('Updated term %term.', ['%term' => $term->getName(), 'link' => $edit_link]); $form_state->setRedirect('entity.taxonomy_term.canonical', ['taxonomy_term' => $term->id()]); break; } -- GitLab