namespace :monitor do desc "executes the monitoring logic" task :run => :environment do Rails.logger = Logger.new(STDOUT) Rails.logger.level = Logger::INFO Rails.logger.info "About to check #{ENV["EMAIL"]} inbox..." res = MonitorInbox.call! Rails.logger.info "A total of #{res.analyzed_emails_count} new emails were analyzed" 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