Skip to content
Browse files

Less verbose mail logging: just recipients for :info log level; the w…

…hole email for :debug only. Closes #8000.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8781 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 5bbc461 commit fbd3eb7142e2ac51b230ab2fff83feb800e1b50c @jeremy jeremy committed Feb 2, 2008
Showing with 8 additions and 2 deletions.
  1. +2 −0 actionmailer/CHANGELOG
  2. +4 −1 actionmailer/lib/action_mailer/base.rb
  3. +2 −1 actionmailer/test/mail_service_test.rb
View
2 actionmailer/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Less verbose mail logging: just recipients for :info log level; the whole email for :debug only. #8000 [iaddict, Tarmo Tänav]
+
* Updated TMail to version 1.2.1 [raasdnil]
* Fixed that you don't have to call super in ActionMailer::TestCase#setup #10406 [jamesgolick]
View
5 actionmailer/lib/action_mailer/base.rb
@@ -468,7 +468,10 @@ def create!(method_name, *parameters) #:nodoc:
# no alternate has been given as the parameter, this will fail.
def deliver!(mail = @mail)
raise "no mail object available for delivery!" unless mail
- logger.info "Sent mail:\n #{mail.encoded}" unless logger.nil?
+ unless logger.nil?
+ logger.info "Sent mail to #{recipients.to_a.join(', ')}"
+ logger.debug "\n#{mail.encoded}"
+ end
begin
__send__("perform_delivery_#{delivery_method}", mail) if perform_deliveries
View
3 actionmailer/test/mail_service_test.rb
@@ -534,7 +534,8 @@ def test_performs_delivery_via_sendmail
def test_delivery_logs_sent_mail
mail = TestMailer.create_signed_up(@recipient)
logger = mock()
- logger.expects(:info).with("Sent mail:\n #{mail.encoded}")
+ logger.expects(:info).with("Sent mail to #{@recipient}")
+ logger.expects(:debug).with("\n#{mail.encoded}")
TestMailer.logger = logger
TestMailer.deliver_signed_up(@recipient)
end

0 comments on commit fbd3eb7

Please sign in to comment.
Something went wrong with that request. Please try again.