From 0095779b3fac88a33711e72f9c91883efb0af54a Mon Sep 17 00:00:00 2001 From: Thibaut Courouble Date: Sun, 25 Mar 2018 16:05:24 -0400 Subject: [PATCH] Instrument FileScraper read errors rather than use puts --- lib/docs/core/scrapers/file_scraper.rb | 2 +- lib/docs/subscribers/doc_subscriber.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/docs/core/scrapers/file_scraper.rb b/lib/docs/core/scrapers/file_scraper.rb index a8f29d62..4ec6a72f 100644 --- a/lib/docs/core/scrapers/file_scraper.rb +++ b/lib/docs/core/scrapers/file_scraper.rb @@ -41,7 +41,7 @@ module Docs def read_file(path) File.read(path) rescue - puts "Failed to open file: #{path}" + instrument 'warn.doc', msg: "Failed to open file: #{path}" nil end end diff --git a/lib/docs/subscribers/doc_subscriber.rb b/lib/docs/subscribers/doc_subscriber.rb index 77386188..dfc5c20e 100644 --- a/lib/docs/subscribers/doc_subscriber.rb +++ b/lib/docs/subscribers/doc_subscriber.rb @@ -26,6 +26,10 @@ module Docs log event.payload[:msg] end + def warn(event) + log "ERROR: #{event.payload[:msg]}" + end + def error(event) exception = event.payload[:exception] log "ERROR:"