Skip to content

Commit

Permalink
add rails to logger
Browse files Browse the repository at this point in the history
  • Loading branch information
kjgarza committed Feb 4, 2020
1 parent babb951 commit 6b6fae3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -536,15 +536,15 @@ def self.subj_id_check(options = {})
total_errors = 0

response = Event.query(nil, source_id: "datacite-crossref,datacite-related", page: { size: 1, cursor: [] })
logger.info "[DoubleCheck] #{response.results.total} events for source datacite-crossref,datacite-related."
Rails.logger.info "[DoubleCheck] #{response.results.total} events for source datacite-crossref,datacite-related."

# walk through results using cursor
if response.results.total.positive?
while response.results.results.length.positive?
response = Event.query(nil, source_id: "datacite-crossref,datacite-related", page: { size: size, cursor: cursor })
break unless response.results.results.length.positive?

logger.info "[DoubleCheck] DoubleCheck #{response.results.results.length} events starting with _id #{response.results.to_a.first[:_id]}."
Rails.logger.info "[DoubleCheck] DoubleCheck #{response.results.results.length} events starting with _id #{response.results.to_a.first[:_id]}."
cursor = response.results.to_a.last[:sort]

# dois = response.results.results.map(&:subj_id)
Expand All @@ -566,8 +566,8 @@ def self.subj_id_check(options = {})
payload = { description: "events_with_errors_from_rake_task #{Time.now.getutc}", public: true,files: {uids_with_errors: {content: file.read} }}
### max file size 1MB
response = Maremma.post("https://api.github.com/gists", data: payload.to_json, username: ENV["GIST_USERNAME"], password:ENV["GIST_PASSWORD"])
logger.warn "[DoubleCheck] Total number of events with Errors: #{total_errors}"
logger.warn "[DoubleCheck] IDs saved: #{response.body.dig('data','url')}" if [200,201].include?(response.status)
Rails.logger.warn "[DoubleCheck] Total number of events with Errors: #{total_errors}"
Rails.logger.warn "[DoubleCheck] IDs saved: #{response.body.dig('data','url')}" if [200,201].include?(response.status)
end
end

Expand Down

0 comments on commit 6b6fae3

Please sign in to comment.