Skip to content

Commit

Permalink
Merge pull request #304 from samvera/fix/ip_logging
Browse files Browse the repository at this point in the history
make ip logging more robust
  • Loading branch information
elrayle committed Dec 17, 2019
2 parents 926d9e6 + 0114e1f commit 993e0f0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/services/qa/linked_data/request_header_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,14 @@ def content_type_for_format
private

def log_request
gc = request.location
msg = "******** #{request.path_parameters[:action].upcase}"
msg += " from IP #{request.ip} in {city: #{gc.city}, state: #{gc.state}, country: #{gc.country}}" unless Qa.config.suppress_ip_data_from_log
unless Qa.config.suppress_ip_data_from_log
gc = request.respond_to?(:location) ? request.location : nil
city = gc.nil? ? "UNKNOWN" : gc.city
state = gc.nil? ? "UNKNOWN" : gc.state
country = gc.nil? ? "UNKNOWN" : gc.country
msg += " from IP #{request.ip} in {city: #{city}, state: #{state}, country: #{country}}"
end
Rails.logger.info(msg)
end

Expand Down

0 comments on commit 993e0f0

Please sign in to comment.