Sha256: 0300a124468d40a99953be3a36dee4e12c4f802dd7f929747b26a43e2c216388
Contents?: true
Size: 728 Bytes
Versions: 14
Compression:
Stored size: 728 Bytes
Contents
require 'mail/smtp_envelope' module Mail class LoggerDelivery attr_reader :logger, :severity, :settings def initialize(settings) @settings = settings @logger = settings.fetch(:logger) { default_logger } @severity = derive_severity(settings[:severity]) end def deliver!(mail) logger.log(severity) { Mail::SmtpEnvelope.new(mail).message } end private def default_logger require 'logger' ::Logger.new($stdout) end def derive_severity(severity) case severity when nil Logger::INFO when Integer severity else Logger.const_get(severity.to_s.upcase) end end end end
Version data entries
14 entries across 14 versions & 5 rubygems