mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
Use log() method instead of puts
This commit is contained in:
parent
dadb8ba88a
commit
5c7e07dbb5
3 changed files with 23 additions and 8 deletions
|
@ -5,17 +5,17 @@ namespace :contacts do
|
|||
unlinked_contacts = contacts_start_point(args[:track_id])
|
||||
|
||||
counter = 0
|
||||
puts "Found #{unlinked_contacts.count} unlinked contacts. Starting to archive."
|
||||
log("Found #{unlinked_contacts.count} unlinked contacts. Starting to archive.")
|
||||
|
||||
unlinked_contacts.each do |contact|
|
||||
next unless contact.archivable?
|
||||
|
||||
puts "Archiving contact: id(#{contact.id}), code(#{contact.code})"
|
||||
log("Archiving contact: id(#{contact.id}), code(#{contact.code})")
|
||||
contact.archive(verified: true)
|
||||
counter += 1
|
||||
end
|
||||
|
||||
puts "Archived total: #{counter}"
|
||||
log("Archived total: #{counter}")
|
||||
end
|
||||
|
||||
def contacts_start_point(track_id = nil)
|
||||
|
@ -24,4 +24,9 @@ namespace :contacts do
|
|||
|
||||
Contact.unlinked.where("id > #{track_id}")
|
||||
end
|
||||
|
||||
def log(msg)
|
||||
@log ||= Logger.new(STDOUT)
|
||||
@log.info(msg)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue