3 changed files with 16 additions and 7 deletions
@ -1,9 +1,19 @@ |
|||||
namespace :monitor do |
namespace :monitor do |
||||
desc "executes the monitoring logic" |
desc "executes the monitoring logic" |
||||
task :run => :environment do |
task :run => :environment do |
||||
puts "About to check #{ENV["EMAIL"]} inbox..." |
Rails.logger = Logger.new(STDOUT) |
||||
|
Rails.logger.level = Logger::INFO |
||||
|
Rails.logger.info "About to check #{ENV["EMAIL"]} inbox..." |
||||
res = MonitorInbox.call! |
res = MonitorInbox.call! |
||||
puts "A total of #{res.analyzed_emails_count} new emails were analyzed" |
Rails.logger.info "A total of #{res.analyzed_emails_count} new emails were analyzed" |
||||
puts "A total of #{res.actions_executed_count} actions were triggered" |
Rails.logger.info "A total of #{res.actions_executed_count} actions were triggered" |
||||
|
end |
||||
|
|
||||
|
desc "deletes all log entries" |
||||
|
task :clear_log => :environment do |
||||
|
Rails.logger = Logger.new(STDOUT) |
||||
|
Rails.logger.level = Logger::INFO |
||||
|
Rails.logger.info "About to clear all log entries" |
||||
|
ActionLog.delete_all |
||||
end |
end |
||||
end |
end |
||||
|
|||||
Loading…
Reference in new issue