Commit 61baef91 authored by Tomohiro Ono's avatar Tomohiro Ono Committed by Yas Naoi
Browse files

Issue #3162532 by onotm, yas, Pooja Ganjage: Add $this->t() into logger messages

parent 98f97aca
Loading
Loading
Loading
Loading
+2 −2
Changes for modules/cloud_budget/cloud_budget.module: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -63,10 +63,10 @@ function cloud_budget_update_credits() {
    $cloud_credit->setRefreshed($now);
    $cloud_credit->save();

    \Drupal::logger('cloud_budget')->notice('@type: updated %label.', [
    \Drupal::logger('cloud_budget')->notice(t('@type: updated %label.', [
      '@type' => $cloud_credit->bundle(),
      '%label' => $cloud_credit->label(),
      'link' => $cloud_credit->toLink(t('View'))->toString(),
    ]);
    ]));
  }
}
+2 −4
Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.install: 2 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -1668,12 +1668,10 @@ function aws_cloud_update_8187() {
      }

      if (!($success && $server_template->save())) {
        \Drupal::logger('aws_cloud')->error(
          t('The @type @name could not be created.', [
        \Drupal::logger('aws_cloud')->error(t('The @type @name could not be created.', [
          '@type' => $server_template->getEntityType()->getSingularLabel(),
          '@name' => $server_template->getName(),
          ])
        );
        ]));
      }
    }
  }
+14 −18
Changes for modules/cloud_service_providers/aws_cloud/aws_cloud.module: 14 added lines, 18 removed lines.
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ function aws_cloud_instance_type_allowed_values_function(FieldStorageConfig $def
    }
  }
  catch (\Exception $e) {
    \Drupal::logger('aws_cloud')->debug('No cloud context specified.');
    \Drupal::logger('aws_cloud')->debug(t('No cloud context specified.'));
  }

  return $instance_types;
@@ -188,7 +188,7 @@ function aws_cloud_image_allowed_values_function(FieldStorageConfig $definition,
      }
    }
    catch (\Exception $e) {
      \Drupal::logger('aws_cloud')->debug('No cloud context specified.');
      \Drupal::logger('aws_cloud')->debug(t('No cloud context specified.'));
    }
  }

@@ -229,7 +229,7 @@ function aws_cloud_availability_zone_allowed_values_function(FieldStorageConfig
      $availability_zones = $ec2Service->getAvailabilityZones();
    }
    catch (\Exception $e) {
      \Drupal::logger('aws_cloud')->debug('No cloud context specified.');
      \Drupal::logger('aws_cloud')->debug(t('No cloud context specified.'));
    }
  }

@@ -293,7 +293,7 @@ function aws_cloud_vpc_allowed_values_function(FieldStorageConfig $definition, C
      }
    }
    catch (\Exception $e) {
      \Drupal::logger('aws_cloud')->debug('No cloud context specified.');
      \Drupal::logger('aws_cloud')->debug(t('No cloud context specified.'));
    }
  }

@@ -433,7 +433,7 @@ function aws_cloud_iam_role_allowed_values_function(FieldStorageConfig $definiti
      $allowed_values = aws_cloud_get_iam_roles($cloud_context);
    }
    catch (\Exception $e) {
      \Drupal::logger('aws_cloud')->debug('No cloud context specified.');
      \Drupal::logger('aws_cloud')->debug(t('No cloud context specified.'));
    }
  }

@@ -1561,10 +1561,11 @@ function aws_cloud_form_cloud_server_template_revision_revert_confirm_submit(arr
      $revision->setRevisionCreationTime(\Drupal::time()->getRequestTime());
      $revision->save();

      \Drupal::logger('aws_cloud')->notice(
        'Launch template: reverted %title revision %revision.',
        ['%title' => $revision->label(), '%revision' => $original_revision_id]
      );
      \Drupal::logger('aws_cloud')->notice(t('Launch template: reverted %title revision %revision.', [
        '%title' => $revision->label(),
        '%revision' => $original_revision_id,
      ]));

      \Drupal::messenger()->addStatus(t('The launch template %title has been reverted to the revision from %revision-date.', [
        '%title' => $revision->label(),
        '%revision-date' => \Drupal::service('date.formatter')->format($original_revision_timestamp),
@@ -2706,7 +2707,7 @@ function aws_cloud_get_subnet_options_by_vpc_id($vpc_id, EntityInterface $entity
    }
  }
  catch (\Exception $e) {
    \Drupal::logger('aws_cloud')->debug('No cloud context specified.');
    \Drupal::logger('aws_cloud')->debug(t('No cloud context specified.'));
  }

  return $options;
@@ -3030,16 +3031,11 @@ function aws_cloud_send_notification_email($subject, $message, $emails, $mail_ho
    ]
  );
  if (isset($result['result'])) {
    \Drupal::logger('aws_cloud')->notice(
      t(
        'An @type notification has been sent to @email for @types with the subject @subject.',
        [
    \Drupal::logger('aws_cloud')->notice(t('An @type notification has been sent to @email for @types with the subject @subject.', [
      '@type' => $message_type,
      '@email' => $emails,
      '@subject' => $subject,
        ]
      )
    );
    ]));
  }
}

@@ -3471,7 +3467,7 @@ function aws_cloud_get_instance_types($cloud_context) {
    }
  }
  catch (\Exception $e) {
    \Drupal::logger('aws_cloud')->debug('No cloud context specified.');
    \Drupal::logger('aws_cloud')->debug(t('No cloud context specified.'));
  }
  return $instance_types;
}
+2 −2
Changes for modules/cloud_service_providers/aws_cloud/src/Form/Ec2/ImageDeleteForm.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -84,11 +84,11 @@ class ImageDeleteForm extends AwsDeleteForm {
        '@label' => $entity->getName(),
      ]));

      $this->logger($entity->getEntityType()->getProvider())->error('@type: @label could not be deleted.', [
      $this->logger($entity->getEntityType()->getProvider())->error($this->t('@type: @label could not be deleted.', [
        '@type' => $entity->getEntityType()->getLabel(),
        '@label' => $entity->label(),
        'link' => $entity->toLink($entity->t('View'))->toString(),
      ]);
      ]));
    }

    $form_state->setRedirect("view.{$entity->getEntityTypeId()}.list", ['cloud_context' => $entity->getCloudContext()]);
+3 −1
Changes for modules/cloud_service_providers/aws_cloud/src/Plugin/QueueWorker/AwsCloudUpdateResourcesQueueWorker.php: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -81,7 +81,9 @@ class AwsCloudUpdateResourcesQueueWorker extends QueueWorkerBase implements Cont
    $this->ec2Service->setCloudContext($cloud_context);

    if (!method_exists($this->ec2Service, $ec2_method_name)) {
      $this->logger->error("The method $ec2_method_name doesn't exist in class Ec2Service.");
      $this->logger->error($this->t("The method @ec2_method_name doesn't exist in class Ec2Service.", [
        '@ec2_method_name' => $ec2_method_name,
      ]));
      return;
    }

Loading