vendor/gems/logging-0.9.7/lib/logging/appenders/email.rb
def flush
    return self if buffer.empty?

    ### build a mail header for RFC 822
    rfc822msg =  "From: #{@from}\n"
    rfc822msg << "To: #{@to.join(",")}\n"
    rfc822msg << "Subject: #{@subject}\n"
    rfc822msg << "Date: #{Time.new.rfc822}\n"
    rfc822msg << "Message-Id: <#{"%.8f" % Time.now.to_f}@#{@domain}>\n\n"
    rfc822msg << buffer.join

    ### send email
    Net::SMTP.start(*@params) {|smtp| smtp.sendmail(rfc822msg, @from, @to)}
    self
  rescue StandardError, TimeoutError => err
    self.level = :off
    ::Logging.log_internal {'e-mail notifications have been disabled'}
    ::Logging.log_internal(-2) {err}
  ensure
    buffer.clear
  end
# call-seq:
#    flush
#
# Create and send an email containing the current message buffer.
#
call-seq:
flush

Create and send an email containing the current message buffer.
call - seq : flush Create and send an email containing the current message buffer .
def flush
    return self if buffer.empty?
    rfc822msg =  "From: #{@from}\n"
    rfc822msg << "To: #{@to.join(",")}\n"
    rfc822msg << "Subject: #{@subject}\n"
    rfc822msg << "Date: #{Time.new.rfc822}\n"
    rfc822msg << "Message-Id: <#{"%.8f" % Time.now.to_f}@#{@domain}>\n\n"
    rfc822msg << buffer.join
    Net::SMTP.start(*@params) {|smtp| smtp.sendmail(rfc822msg, @from, @to)}
    self
  rescue StandardError, TimeoutError => err
    self.level = :off
    ::Logging.log_internal {'e-mail notifications have been disabled'}
    ::Logging.log_internal(-2) {err}
  ensure
    buffer.clear
  end
def flush return self if buffer . empty? rfc822msg = "From: #{@from}\n" rfc822msg << "To: #{@to.join(",")}\n" rfc822msg << "Subject: #{@subject}\n" rfc822msg << "Date: #{Time.new.rfc822}\n" rfc822msg << "Message-Id: <#{"%.8f" % Time.now.to_f}@#{@domain}>\n\n" rfc822msg << buffer . join Net :: SMTP . start ( * @params ) { | smtp | smtp . sendmail ( rfc822msg , @from , @to ) } self rescue StandardError , TimeoutError => err self . level = :off :: Logging . log_internal { 'e-mail notifications have been disabled' } :: Logging . log_internal ( - 2 ) { err } ensure buffer . clear end
call-seq:
flush
call - seq : flush
### build a mail header for RFC 822 ### send email