Use logger instead of STDOUT

This commit is contained in:
Omar Roth 2019-01-24 12:16:10 -06:00
parent 16a7fcb79b
commit 75d8c4f5c0

View file

@ -21,7 +21,7 @@ def crawl_videos(db)
id = ids[0]
video = get_video(id, db)
rescue ex
STDOUT << id << " : " << ex.message << "\n"
logger.write("#{id} : #{ex.message}\n")
next
ensure
ids.delete(id)
@ -73,7 +73,7 @@ def refresh_channels(db, max_threads = 1, full_refresh = false)
db.exec("UPDATE channels SET updated = $1, author = $2 WHERE id = $3", Time.now, channel.author, id)
rescue ex
STDOUT << id << " : " << ex.message << "\n"
logger.write("#{id} : #{ex.message}\n")
end
active_channel.send(true)
@ -94,7 +94,7 @@ def refresh_videos(db)
id = rs.read(String)
video = get_video(id, db)
rescue ex
STDOUT << id << " : " << ex.message << "\n"
logger.write("#{id} : #{ex.message}\n")
next
end
end
@ -129,7 +129,7 @@ def refresh_feeds(db, max_threads = 1)
begin
db.exec("REFRESH MATERIALIZED VIEW #{view_name}")
rescue ex
STDOUT << "REFRESH " << email << " : " << ex.message << "\n"
logger.write("REFRESH #{email} : #{ex.message}\n")
end
active_channel.send(true)