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