aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer/log_subscriber.rb
Commit message (Collapse)AuthorAgeFilesLines
* applies new string literal convention in actionmailer/libXavier Noria2016-08-061-2/+2
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Remove newlines from start of logsOwen Davies2015-10-261-3/+3
| | | | | | Currently if using a single line logger, this causes the time stamp and log message to be on separate lines which is not common to how most other logging works.
* Add missing punctuation mark to all ActionMailer docs [ci skip]amitkumarsuroliya2015-09-281-1/+1
|
* minor text changeManish Puri2015-05-291-1/+1
|
* Prefer to pass block when logging.Guo Xiang Tan2014-07-181-11/+13
| | | | | | | | The Logger by default includes a guard which checks for the logging level. By removing the custom logging guards, we can decouple the logging guard from the logging action to be done. This also follows the good practice listed on http://guides.rubyonrails.org/debugging_rails_applications.html#impact-of-logs-on-performance.
* Add `logger.debug?` guard to `ActionMailer::LogSubscriber#process`Viktar Basharymau2014-06-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *TLDR*: The method is 4 times faster when log level is higher than DEBUG. Also, the other two methods, `#deliver` and `#receive` have similar guard statements, so this commit adds some symmetry to the code. This is probably not the most critical part of ActionMailer in terms of performance, but here are some benchmarks: ``` require 'benchmark/ips' require 'action_mailer' event = ActiveSupport::Notifications::Event.new( 'process.action_mailer', Time.now, Time.now, 'bf4e2b36ce085fd35b24', { mailer: "UserMailer", action: :welcome } ) ActionMailer::Base.logger = ActiveSupport::Logger.new '/dev/null' subscriber = ActionMailer::LogSubscriber.new def subscriber.process_with_guard(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") end Benchmark.ips do |r| ActionMailer::Base.logger.level = ::Logger::Severity::INFO r.report('no guard') { subscriber.process(event) } r.report(' guard') { subscriber.process_with_guard(event) } end __END__ Calculating ------------------------------------- no guard 9640 i/100ms guard 38381 i/100ms ------------------------------------------------- no guard 169166.9 (±10.2%) i/s - 838680 in 5.007262s guard 728184.9 (±9.6%) i/s - 3607814 in 4.999218s ``` When log level is DEBUG, the _guarded_ method is a bit slower. This is a good tradeoff for 4x improvement in production mode. ``` Benchmark.ips do |r| ActionMailer::Base.logger.level = ::Logger::Severity::DEBUG r.report('no guard') { subscriber.process(event) } r.report(' guard') { subscriber.process_with_guard(event) } end __END__ Calculating ------------------------------------- no guard 4970 i/100ms guard 4564 i/100ms ------------------------------------------------- no guard 55617.4 (±3.5%) i/s - 278320 in 5.010523s guard 49452.1 (±5.6%) i/s - 251020 in 5.093358s ```
* Instrument the generation of Action Mailer messagesDaniel Schierbeck2013-10-201-0/+7
| | | | | | The processing of outbound mail is instrumented with the key `process.action_mailer`. The payload includes the mailer name as well as the mailer method.
* Require log_subscriberŁukasz Strzałkowski2013-08-251-0/+2
|
* Revert "nodoc ActionMailer module from lib/action_mailer/*.rb"Vijay Dev2013-05-191-1/+1
| | | | | | | | This reverts commit 328e876a1569058e47eaf7ea3f4f045a83b585fa. Reason: Let's not nodoc without reason. [ci skip]
* nodoc ActionMailer module from lib/action_mailer/*.rbZachary Scott2013-05-151-1/+1
|
* Document ActionMailer::LogSubscriber and ↵Zachary Scott2013-05-151-0/+5
| | | | ActionMailer::DeliveryMethods::ClassMethods
* Optimize log subscribers to check if the log level is sufficient before ↵Brian Durand2012-09-301-2/+4
| | | | performing an operations.
* Array.wrap is no longer needed hereRafael Mendonça França2012-01-051-4/+2
|
* Move Rails::LogSubscriber to ActiveSupport::LogSubscriber, allowing ↵José Valim2010-06-241-0/+22
frameworks like ActiveRecord and ActiveResource to log outsude Rails::Application [#4816 state:resolved]