aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer/log_subscriber.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailer/lib/action_mailer/log_subscriber.rb')
-rw-r--r--actionmailer/lib/action_mailer/log_subscriber.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/actionmailer/lib/action_mailer/log_subscriber.rb b/actionmailer/lib/action_mailer/log_subscriber.rb
index 2867bf90fb..25c99342c2 100644
--- a/actionmailer/lib/action_mailer/log_subscriber.rb
+++ b/actionmailer/lib/action_mailer/log_subscriber.rb
@@ -1,4 +1,6 @@
-require 'active_support/log_subscriber'
+# frozen_string_literal: true
+
+require "active_support/log_subscriber"
module ActionMailer
# Implements the ActiveSupport::LogSubscriber for logging notifications when
@@ -7,8 +9,13 @@ module ActionMailer
# An email was delivered.
def deliver(event)
info do
- recipients = Array(event.payload[:to]).join(', ')
- "Sent mail to #{recipients} (#{event.duration.round(1)}ms)"
+ perform_deliveries = event.payload[:perform_deliveries]
+ recipients = Array(event.payload[:to]).join(", ")
+ if perform_deliveries
+ "Sent mail to #{recipients} (#{event.duration.round(1)}ms)"
+ else
+ "Skipped sending mail to #{recipients} as `perform_deliveries` is false"
+ end
end
debug { event.payload[:mail] }