diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2013-10-20 15:46:22 -0700 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2013-10-20 15:46:22 -0700 |
commit | fdfc96750a396d385d05ea1bf2de58c4d777e72e (patch) | |
tree | 05b7ace2d4938c8376cdc3580526e279f930f4b8 /actionmailer/lib/action_mailer | |
parent | cc8d14827d117ed7da7a17c4a057a8e5f71625ca (diff) | |
parent | 8f0c5e00ff61cc2f61acedfb35de756bd0e95437 (diff) | |
download | rails-fdfc96750a396d385d05ea1bf2de58c4d777e72e.tar.gz rails-fdfc96750a396d385d05ea1bf2de58c4d777e72e.tar.bz2 rails-fdfc96750a396d385d05ea1bf2de58c4d777e72e.zip |
Merge pull request #12556 from dasch/dasch/nstrument-am-processing
Instrument the generation of Action Mailer messages
Diffstat (limited to 'actionmailer/lib/action_mailer')
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 15 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/log_subscriber.rb | 7 |
2 files changed, 18 insertions, 4 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index ada86fbc4f..6357805198 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -511,11 +511,18 @@ module ActionMailer process(method_name, *args) if method_name end - def process(*args) #:nodoc: - lookup_context.skip_default_locale! + def process(method_name, *args) #:nodoc: + payload = { + :mailer => self.class.name, + :action => method_name + } - super - @_message = NullMail.new unless @_mail_was_called + ActiveSupport::Notifications.instrument("process.action_mailer", payload) do + lookup_context.skip_default_locale! + + super + @_message = NullMail.new unless @_mail_was_called + end end class NullMail #:nodoc: diff --git a/actionmailer/lib/action_mailer/log_subscriber.rb b/actionmailer/lib/action_mailer/log_subscriber.rb index 8467d45986..eb6fb11d81 100644 --- a/actionmailer/lib/action_mailer/log_subscriber.rb +++ b/actionmailer/lib/action_mailer/log_subscriber.rb @@ -19,6 +19,13 @@ module ActionMailer debug(event.payload[:mail]) end + # An email was generated. + def process(event) + mailer = event.payload[:mailer] + action = event.payload[:action] + debug("\n#{mailer}##{action}: processed outbound mail in #{event.duration.round(1)}ms") + end + # Use the logger configured for ActionMailer::Base def logger ActionMailer::Base.logger |