Sha256: c0c29fe21c4ac6190b8b979b8f37a367d558ef775346144e58ced6a5488b597e

Contents?: true

Size: 581 Bytes

Versions: 30

Compression:

Stored size: 581 Bytes

Contents

module ActionMailer
  class LogSubscriber < ActiveSupport::LogSubscriber
    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])
    end

    def receive(event)
      return unless logger.info?
      info("\nReceived mail (#{event.duration.round(1)}ms)")
      debug(event.payload[:mail])
    end

    def logger
      ActionMailer::Base.logger
    end
  end
end

ActionMailer::LogSubscriber.attach_to :action_mailer

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
actionmailer-4.0.13 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.13.rc1 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.11.1 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.12 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.11 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.10 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.10.rc2 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.10.rc1 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.9 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.8 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.7 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.6 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.6.rc3 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.6.rc2 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.6.rc1 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.5 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.4 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.4.rc1 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.3 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.2 lib/action_mailer/log_subscriber.rb