aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-10-01 20:28:31 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-10-01 20:28:31 -0700
commitcfc0ca0516d818bffdd5959ebe415362965d2de0 (patch)
tree6a111e99a0997fc6745e8b3ef3c1916d6ab7b394 /actionmailer
parent8ea88c3b74a20b56d39ab820244e0b3806a84169 (diff)
parent8e1b02fc37ef7404ce6f35d93a956eccf457d572 (diff)
downloadrails-cfc0ca0516d818bffdd5959ebe415362965d2de0.tar.gz
rails-cfc0ca0516d818bffdd5959ebe415362965d2de0.tar.bz2
rails-cfc0ca0516d818bffdd5959ebe415362965d2de0.zip
Merge pull request #7708 from bdurand/optimize_log_subscribers
Optimize log subscribers to check if the log level is sufficient
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/lib/action_mailer/log_subscriber.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/actionmailer/lib/action_mailer/log_subscriber.rb b/actionmailer/lib/action_mailer/log_subscriber.rb
index a6c163832e..3fe64759ac 100644
--- a/actionmailer/lib/action_mailer/log_subscriber.rb
+++ b/actionmailer/lib/action_mailer/log_subscriber.rb
@@ -1,13 +1,15 @@
module ActionMailer
class LogSubscriber < ActiveSupport::LogSubscriber
def deliver(event)
+ return unless logger.info?
recipients = Array(event.payload[:to]).join(', ')
- info("\nSent mail to #{recipients} (%1.fms)" % event.duration)
+ info("\nSent mail to #{recipients} (#{event.duration.round(1)}ms)")
debug(event.payload[:mail])
end
def receive(event)
- info("\nReceived mail (%.1fms)" % event.duration)
+ return unless logger.info?
+ info("\nReceived mail (#{event.duration.round(1)}ms)")
debug(event.payload[:mail])
end