diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-01-22 12:09:07 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-01-22 12:09:07 +0000 |
commit | b9385dceb9c60c2660e05dca972eac22c9030b9b (patch) | |
tree | e788c195ac22a5500cf8f31411f6386523c1b19c /lib/redmine/pop3.rb | |
parent | 494cd8cc363802d6fc15eaeb34fdefe88f15e940 (diff) | |
download | redmine-b9385dceb9c60c2660e05dca972eac22c9030b9b.tar.gz redmine-b9385dceb9c60c2660e05dca972eac22c9030b9b.zip |
Make POP3 mail fetcher log messages instead of puts (#7177).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4737 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/pop3.rb')
-rw-r--r-- | lib/redmine/pop3.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/redmine/pop3.rb b/lib/redmine/pop3.rb index 8697c8df7..ddccfe880 100644 --- a/lib/redmine/pop3.rb +++ b/lib/redmine/pop3.rb @@ -27,30 +27,36 @@ module Redmine delete_unprocessed = (pop_options[:delete_unprocessed].to_s == '1') pop = Net::POP3.APOP(apop).new(host,port) - puts "Connecting to #{host}..." + logger.debug "Connecting to #{host}..." if logger && logger.debug? pop.start(pop_options[:username], pop_options[:password]) do |pop_session| if pop_session.mails.empty? - puts "No email to process" + logger.debug "No email to process" if logger && logger.debug? else - puts "#{pop_session.mails.size} email(s) to process..." + logger.debug "#{pop_session.mails.size} email(s) to process..." if logger && logger.debug? pop_session.each_mail do |msg| message = msg.pop message_id = (message =~ /^Message-ID: (.*)/ ? $1 : '').strip if MailHandler.receive(message, options) msg.delete - puts "--> Message #{message_id} processed and deleted from the server" + logger.debug "--> Message #{message_id} processed and deleted from the server" if logger && logger.debug? else if delete_unprocessed msg.delete - puts "--> Message #{message_id} NOT processed and deleted from the server" + logger.debug "--> Message #{message_id} NOT processed and deleted from the server" if logger && logger.debug? else - puts "--> Message #{message_id} NOT processed and left on the server" + logger.debug "--> Message #{message_id} NOT processed and left on the server" if logger && logger.debug? end end end end end end + + private + + def logger + RAILS_DEFAULT_LOGGER + end end end end |