Sha256: 1390954cb77b861ffa26df6bb197a9c15c890f0d4d5584f92eb8a5a363e41a42
Contents?: true
Size: 894 Bytes
Versions: 3
Compression:
Stored size: 894 Bytes
Contents
require 'active_support/core_ext/class/attribute' require 'active_support/log_subscriber' module LogStasher module ActiveSupport class MailerLogSubscriber < ::ActiveSupport::LogSubscriber MAILER_FIELDS = %i[mailer action message_id from to].freeze def deliver(event) process_event(event, %w[mailer deliver]) end def receive(event) process_event(event, %w[mailer receive]) end def process(event) process_event(event, %w[mailer process]) end def logger LogStasher.logger end private def process_event(event, tags) data = LogStasher.request_context.merge(extract_metadata(event.payload)) logger << LogStasher.build_logstash_event(data, tags).to_json + "\n" end def extract_metadata(payload) payload.slice(*MAILER_FIELDS) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems