class Epilog::Rails::ActionMailerSubscriber

Public Instance Methods

deliver(event) click to toggle source
# File lib/epilog/rails/action_mailer_subscriber.rb, line 6
def deliver(event)
  info do
    hash(
      event,
      message: 'Sent mail',
      recipients: Array(event.payload[:to])
    )
  end
end
process(event) click to toggle source
# File lib/epilog/rails/action_mailer_subscriber.rb, line 25
def process(event)
  debug do
    hash(
      event,
      message: 'Processed outbound mail',
      mailer: event.payload[:mailer],
      action: event.payload[:action]
    )
  end
end
receive(event) click to toggle source
# File lib/epilog/rails/action_mailer_subscriber.rb, line 16
def receive(event)
  info do
    hash(
      event,
      message: 'Received mail'
    )
  end
end

Private Instance Methods

hash(event, attrs = {}) click to toggle source
# File lib/epilog/rails/action_mailer_subscriber.rb, line 38
def hash(event, attrs = {})
  if logger.debug? && event.payload[:mail]
    attrs[:body] = event.payload[:mail]
  end

  attrs[:metrics] = { duration: event.duration.round(2) }
  attrs
end