Replace puts with proper logging (#2139)
This commit is contained in:
parent
6435785017
commit
116d6b3278
11 changed files with 22 additions and 22 deletions
|
|
@ -20,8 +20,8 @@ class EmailDigest
|
|||
articles = user_email_heuristic.articles_to_send
|
||||
begin
|
||||
DigestMailer.digest_email(user, articles).deliver
|
||||
rescue StandardError
|
||||
puts "Email issue"
|
||||
rescue StandardError => e
|
||||
Rails.logger.error("Email issue: #{e}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class PodcastFeed
|
|||
end
|
||||
feed.items.size
|
||||
rescue StandardError => e
|
||||
puts e.message
|
||||
Rails.logger.error(e)
|
||||
end
|
||||
|
||||
def create_new_episode(item, podcast)
|
||||
|
|
@ -35,8 +35,8 @@ class PodcastFeed
|
|||
get_media_url(ep, item, podcast)
|
||||
begin
|
||||
ep.published_at = item.pubDate.to_date
|
||||
rescue StandardError
|
||||
puts "not valid date"
|
||||
rescue StandardError => e
|
||||
Rails.logger.error("not a valid date: #{e}")
|
||||
end
|
||||
ep.body = item.content_encoded || item.itunes_summary || item.description
|
||||
ep.save!
|
||||
|
|
@ -47,8 +47,8 @@ class PodcastFeed
|
|||
begin
|
||||
episode.published_at = item.pubDate.to_date
|
||||
episode.save
|
||||
rescue StandardError
|
||||
puts "not valid date"
|
||||
rescue StandardError => e
|
||||
Rails.logger.error("not a valid date: #{e}")
|
||||
end
|
||||
end
|
||||
update_media_url(episode, item)
|
||||
|
|
@ -84,6 +84,6 @@ class PodcastFeed
|
|||
end
|
||||
rescue StandardError
|
||||
message = "something went wrong with #{podcast.title}, #{episode.title} -- #{episode.media_url}"
|
||||
logger.info message
|
||||
Rails.logger.error(message)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ class Article < ApplicationRecord
|
|||
duration
|
||||
end
|
||||
rescue StandardError => e
|
||||
puts e.message
|
||||
Rails.logger.error(e)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -106,8 +106,8 @@ class Organization < ApplicationRecord
|
|||
articles.find_each do |article|
|
||||
cache_buster.bust(article.path)
|
||||
end
|
||||
rescue StandardError
|
||||
puts "Tag issue"
|
||||
rescue StandardError => e
|
||||
Rails.logger.error("Tag issue: #{e}")
|
||||
end
|
||||
end
|
||||
handle_asynchronously :bust_cache
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Tweet < ApplicationRecord
|
|||
begin
|
||||
return tweet = try_to_get_tweet(twitter_id_code)
|
||||
rescue StandardError => e
|
||||
puts e
|
||||
Rails.logger.error(e)
|
||||
tries += 1
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class ArticleObserver < ApplicationObserver
|
|||
|
||||
end
|
||||
warned_user_ping(article)
|
||||
rescue StandardError
|
||||
puts "error"
|
||||
rescue StandardError => e
|
||||
Rails.logger.error(e)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ class CommentObserver < ApplicationObserver
|
|||
return if Rails.env.development?
|
||||
|
||||
warned_user_ping(comment)
|
||||
rescue StandardError
|
||||
puts "error"
|
||||
rescue StandardError => e
|
||||
Rails.logger.error(e)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class OrganizationObserver < ActiveRecord::Observer
|
|||
username: "org_bot",
|
||||
icon_emoji: ":office:",
|
||||
)
|
||||
rescue StandardError
|
||||
puts "error"
|
||||
rescue StandardError => e
|
||||
Rails.logger.error(e)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class ReactionObserver < ActiveRecord::Observer
|
|||
icon_emoji: ":cry:",
|
||||
)
|
||||
end
|
||||
rescue StandardError
|
||||
puts "observer error"
|
||||
rescue StandardError => e
|
||||
Rails.logger.error("observer error: #{e}")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ HtmlVariant.create(
|
|||
)
|
||||
##############################################################################
|
||||
|
||||
puts <<-ASCII
|
||||
Rails.logger.info <<-ASCII
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ RSpec.configure do |config|
|
|||
if config.filter_manager.inclusions.rules.include?(:live)
|
||||
WebMock.allow_net_connect!
|
||||
StripeMock.toggle_live(true)
|
||||
puts "Running **live** tests against Stripe..."
|
||||
Rails.logger.info("Running **live** tests against Stripe...")
|
||||
end
|
||||
|
||||
config.before do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue