Skip to content

Commit

Permalink
feat: change log level for webhook triggering logs from debug to info
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jun 8, 2019
1 parent 123bf93 commit 2dca79c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/pact_broker/webhooks/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def reschedule_job?
end

def reschedule_job
logger.debug "Re-enqeuing job for webhook #{triggered_webhook.webhook_uuid} to run in #{backoff_time} seconds"
logger.info "Re-enqeuing job for webhook #{triggered_webhook.webhook_uuid} to run in #{backoff_time} seconds"
Job.perform_in(backoff_time, @data.merge(error_count: error_count+1))
end

Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/webhooks/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def self.trigger_webhooks pact, verification, event_name, options
if webhooks.any?
run_later(webhooks, pact, verification, event_name, options)
else
logger.debug "No enabled webhooks found for consumer \"#{pact.consumer.name}\" and provider \"#{pact.provider.name}\" and event #{event_name}"
logger.info "No enabled webhooks found for consumer \"#{pact.consumer.name}\" and provider \"#{pact.provider.name}\" and event #{event_name}"
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/pact_broker/webhooks/trigger_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ def trigger_webhooks_for_new_pact(pact, webhook_options)
if pact_is_new_or_newly_tagged_or_pact_has_changed_since_previous_version?(pact)
webhook_service.trigger_webhooks pact, nil, PactBroker::Webhooks::WebhookEvent::CONTRACT_CONTENT_CHANGED, webhook_options
else
logger.debug "Pact content has not changed since previous version, not triggering webhooks for changed content"
logger.info "Pact content has not changed since previous version, not triggering webhooks for changed content"
end
end

def trigger_webhooks_for_updated_pact(existing_pact, updated_pact, webhook_options)
webhook_service.trigger_webhooks updated_pact, nil, PactBroker::Webhooks::WebhookEvent::CONTRACT_PUBLISHED, webhook_options
# TODO this should use the sha!
if existing_pact.pact_version_sha != updated_pact.pact_version_sha
logger.debug "Existing pact for version #{existing_pact.consumer_version_number} has been updated with new content, triggering webhooks for changed content"
logger.info "Existing pact for version #{existing_pact.consumer_version_number} has been updated with new content, triggering webhooks for changed content"
webhook_service.trigger_webhooks updated_pact, nil, PactBroker::Webhooks::WebhookEvent::CONTRACT_CONTENT_CHANGED, webhook_options
else
logger.debug "Pact content has not changed since previous revision, not triggering webhooks for changed content"
logger.info "Pact content has not changed since previous revision, not triggering webhooks for changed content"
end
end

Expand Down Expand Up @@ -60,7 +60,7 @@ def print_debug_messages(changed_pacts)
end
end
end
logger.debug("Webhook triggered for the following reasons: #{messages.join(',')}" )
logger.info("Webhook triggered for the following reasons: #{messages.join(',')}" )
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/pact_broker/webhooks/service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ module Webhooks
end

it "logs that no webhook was found" do
expect(logger).to receive(:debug).with(/No enabled webhooks found/)
expect(logger).to receive(:info).with(/No enabled webhooks found/)
subject
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/lib/pact_broker/webhooks/trigger_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module Webhooks
include_examples "triggering a contract_content_changed event"

it "logs the reason why it triggered the contract_content_changed event" do
expect(logger).to receive(:debug).with(/first time untagged pact published/)
expect(logger).to receive(:info).with(/first time untagged pact published/)
subject
end
end
Expand All @@ -64,7 +64,7 @@ module Webhooks
include_examples "triggering a contract_content_changed event"

it "logs the reason why it triggered the contract_content_changed event" do
expect(logger).to receive(:debug).with(/pact content has changed since previous untagged version/)
expect(logger).to receive(:info).with(/pact content has changed since previous untagged version/)
subject
end
end
Expand All @@ -86,7 +86,7 @@ module Webhooks
include_examples "triggering a contract_content_changed event"

it "logs the reason why it triggered the contract_content_changed event" do
expect(logger).to receive(:debug).with(/first time pact published with consumer version tagged dev/)
expect(logger).to receive(:info).with(/first time pact published with consumer version tagged dev/)
subject
end
end
Expand Down Expand Up @@ -126,7 +126,7 @@ module Webhooks
include_examples "triggering a contract_content_changed event"

it "logs the reason why it triggered the contract_content_changed event" do
expect(logger).to receive(:debug).with(/version 1.2.3 has been updated with new content/)
expect(logger).to receive(:info).with(/version 1.2.3 has been updated with new content/)
subject
end
end
Expand Down

0 comments on commit 2dca79c

Please sign in to comment.