diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-07-18 09:09:05 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-07-18 09:09:05 +0200 |
commit | e44cb39663ad672c80aafa3615dd0d61148c2077 (patch) | |
tree | 51bf939c44a735fe9aad005f1f9c880a396bbc73 /actionmailer | |
parent | d4c8068675f0b6be025590471b40ff175daa845e (diff) | |
parent | ee35b79d4cff24b960be54c3f5c4f46627c069fe (diff) | |
download | rails-e44cb39663ad672c80aafa3615dd0d61148c2077.tar.gz rails-e44cb39663ad672c80aafa3615dd0d61148c2077.tar.bz2 rails-e44cb39663ad672c80aafa3615dd0d61148c2077.zip |
Merge pull request #16099 from tgxworld/pass_log_as_block
Prefer to pass block when logging.
Diffstat (limited to 'actionmailer')
-rw-r--r-- | actionmailer/lib/action_mailer/log_subscriber.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/actionmailer/lib/action_mailer/log_subscriber.rb b/actionmailer/lib/action_mailer/log_subscriber.rb index e4aaab34b1..5b57c75ec3 100644 --- a/actionmailer/lib/action_mailer/log_subscriber.rb +++ b/actionmailer/lib/action_mailer/log_subscriber.rb @@ -6,25 +6,27 @@ module ActionMailer class LogSubscriber < ActiveSupport::LogSubscriber # An email was delivered. def deliver(event) - return unless logger.info? - recipients = Array(event.payload[:to]).join(', ') - info("\nSent mail to #{recipients} (#{event.duration.round(1)}ms)") - debug(event.payload[:mail]) + info do + recipients = Array(event.payload[:to]).join(', ') + "\nSent mail to #{recipients} (#{event.duration.round(1)}ms)" + end + + debug { event.payload[:mail] } end # An email was received. def receive(event) - return unless logger.info? - info("\nReceived mail (#{event.duration.round(1)}ms)") - debug(event.payload[:mail]) + info { "\nReceived mail (#{event.duration.round(1)}ms)" } + debug { event.payload[:mail] } end # An email was generated. def process(event) - return unless logger.debug? - mailer = event.payload[:mailer] - action = event.payload[:action] - debug("\n#{mailer}##{action}: processed outbound mail in #{event.duration.round(1)}ms") + debug do + mailer = event.payload[:mailer] + action = event.payload[:action] + "\n#{mailer}##{action}: processed outbound mail in #{event.duration.round(1)}ms" + end end # Use the logger configured for ActionMailer::Base |