Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Only log healthcheck fail when LOG_LEVEL=debug is set #101

Merged
merged 1 commit into from
Jul 3, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/percy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ def self._get_agent_js

def self._make_dom_snapshot(page)
agent_js = self._get_agent_js

if self._is_debug?
self._logger.info { "agent_js file: #{agent_js}" }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this log because it's been really helpful to know what this is while debugging various integrations with customers.

end

return unless agent_js

begin
Expand Down Expand Up @@ -99,7 +104,10 @@ def self._is_agent_running?
Net::HTTP.get(AGENT_HOST, '/percy/healthcheck', AGENT_PORT)
return true
rescue => e
self._logger.error { "Healthcheck failed, agent is not running: #{e}" }
if self._is_debug?
self._logger.error { "Healthcheck failed, agent is not running: #{e}" }
end

return false
end
end
Expand All @@ -117,4 +125,8 @@ def self._keys_to_json(options)
end
return options
end

def self._is_debug?
ENV['LOG_LEVEL'] == 'debug'
end
end