Skip to content

Commit

Permalink
lowered logs level to be sent into Sentry + added logging of mails
Browse files Browse the repository at this point in the history
  • Loading branch information
Lung committed Mar 11, 2024
1 parent 44bb83a commit a476a6f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Event/EventType/Cej/EventTypeCej.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function transformPayment(Payment $payment, Participant $participant): Pa
$payment->currency = '';
$payment->variableSymbol = 42438 . substr($payment->variableSymbol, 5);
$payment->constantSymbol = '';

return $payment;
}

Expand Down
9 changes: 8 additions & 1 deletion src/Mailer/PhpMailerWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private function sendMailFromTemplate(
$email->context(array_merge($parameters, [
'fullRegistrationLink' => $this->settings->getFullUrlLink(),
'eventImageExists' => is_file(__DIR__ . '/../../public/' . $event->logoUrl),
]));
]));
array_map(fn (string $attachment) => $email->attach($attachment), $attachments);
foreach ($embeds as $embed) {
$email->embed($embed->resource, $embed->name, $embed->contentType);
Expand All @@ -242,6 +242,13 @@ private function sendMailFromTemplate(
$mailer = new Mailer($transport, dispatcher: $eventDispatcher);

$mailer->send($email);

$this->logger->info(sprintf(
'Sent email to %s with subject %s from template name %s',
$recipientEmail,
$subject,
$templateName,
));
}

/**
Expand Down
9 changes: 2 additions & 7 deletions src/Settings/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,10 @@ public function getContainerDefinition(string $envPath, string $envFilename): ar
$logger->pushHandler(
new StreamHandler('php://stdout', $_ENV['LOGGER_LEVEL']),
);

$sentryHandler = new SentryHandler(
$sentryHub,
Logger::WARNING,
$logger->pushHandler(
new SentryHandler($sentryHub, Logger::INFO),
);

// Log only warnings or higher severity events/errors to Sentry
$logger->pushHandler($sentryHandler);

if ($_ENV['DEBUG'] === 'true') {
$logger->pushHandler(
new StreamHandler(__DIR__ . '/../../logs/debug.log', Logger::DEBUG),
Expand Down
8 changes: 2 additions & 6 deletions src/User/UserRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ public static function adminRoles(): array
public function isEligibleToConfirmPayments(): bool
{
return match ($this) {
self::Admin,
self::ContingentAdminCs,
self::ContingentAdminSk,
=> true,
default
=> false,
self::Admin, self::ContingentAdminCs, self::ContingentAdminSk => true,
default => false,
};
}
}

0 comments on commit a476a6f

Please sign in to comment.