chore: Improve logging for ip look up and audit logs [CW-2145] (#7512)

Co-authored-by: Sojan Jose <sojan@pepalo.com>
This commit is contained in:
Vishnu Narayanan
2023-07-27 16:48:30 +05:30
committed by GitHub
parent 65190422c4
commit 9636478c2a
2 changed files with 10 additions and 4 deletions

View File

@@ -19,6 +19,9 @@ class Api::V1::Accounts::AuditLogsController < Api::V1::Accounts::EnterpriseAcco
else
Current.account.associated_audits.none
end
return if audit_logs_enabled?
Rails.logger.warn("Audit logs are disabled for account #{Current.account.id}")
end
def audit_logs_enabled?

View File

@@ -5,9 +5,12 @@ namespace :ip_lookup do
next if File.exist?(GeocoderConfiguration::LOOK_UP_DB)
ip_lookup_api_key = ENV.fetch('IP_LOOKUP_API_KEY', nil)
next if ip_lookup_api_key.blank?
if ip_lookup_api_key.blank?
Rails.logger.info '[rake ip_lookup:setup] IP_LOOKUP_API_KEY empty. Skipping geoip database setup'
next
end
puts '[rake ip_lookup:setup] Fetch GeoLite2-City database'
Rails.logger.info '[rake ip_lookup:setup] Fetch GeoLite2-City database'
begin
base_url = 'https://download.maxmind.com/app/geoip_download'
@@ -25,9 +28,9 @@ namespace :ip_lookup do
f.print entry.read
end
end
puts '[rake ip_lookup:setup] Fetch complete'
Rails.logger.info '[rake ip_lookup:setup] Fetch complete'
rescue StandardError => e
puts "[rake ip_lookup:setup] #{e.message}"
Rails.logger.error "[rake ip_lookup:setup] #{e.message}"
end
end
end