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.1 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.1.rc4 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.1.rc3 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.1.rc2 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.1.rc1 lib/action_mailer/log_subscriber.rb
challah-1.0.0 vendor/bundle/gems/actionmailer-4.0.0/lib/action_mailer/log_subscriber.rb
actionmailer-4.0.0 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.0.rc2 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.0.rc1 lib/action_mailer/log_subscriber.rb
actionmailer-4.0.0.beta1 lib/action_mailer/log_subscriber.rb