From 2dca79c130f223bd6a2d34822c02be2ee39554f1 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Sat, 8 Jun 2019 22:08:54 +1000 Subject: [PATCH] feat: change log level for webhook triggering logs from debug to info --- lib/pact_broker/webhooks/job.rb | 2 +- lib/pact_broker/webhooks/service.rb | 2 +- lib/pact_broker/webhooks/trigger_service.rb | 8 ++++---- spec/lib/pact_broker/webhooks/service_spec.rb | 2 +- spec/lib/pact_broker/webhooks/trigger_service_spec.rb | 8 ++++---- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/pact_broker/webhooks/job.rb b/lib/pact_broker/webhooks/job.rb index 60b7861eb..628e95c84 100644 --- a/lib/pact_broker/webhooks/job.rb +++ b/lib/pact_broker/webhooks/job.rb @@ -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 diff --git a/lib/pact_broker/webhooks/service.rb b/lib/pact_broker/webhooks/service.rb index ed6dafda2..d217271f7 100644 --- a/lib/pact_broker/webhooks/service.rb +++ b/lib/pact_broker/webhooks/service.rb @@ -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 diff --git a/lib/pact_broker/webhooks/trigger_service.rb b/lib/pact_broker/webhooks/trigger_service.rb index 1f7482c16..c16c9f9bf 100644 --- a/lib/pact_broker/webhooks/trigger_service.rb +++ b/lib/pact_broker/webhooks/trigger_service.rb @@ -14,7 +14,7 @@ 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 @@ -22,10 +22,10 @@ def trigger_webhooks_for_updated_pact(existing_pact, updated_pact, webhook_optio 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 @@ -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 diff --git a/spec/lib/pact_broker/webhooks/service_spec.rb b/spec/lib/pact_broker/webhooks/service_spec.rb index 8e1122c67..9f98edcda 100644 --- a/spec/lib/pact_broker/webhooks/service_spec.rb +++ b/spec/lib/pact_broker/webhooks/service_spec.rb @@ -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 diff --git a/spec/lib/pact_broker/webhooks/trigger_service_spec.rb b/spec/lib/pact_broker/webhooks/trigger_service_spec.rb index 96a80edfa..1908545a2 100644 --- a/spec/lib/pact_broker/webhooks/trigger_service_spec.rb +++ b/spec/lib/pact_broker/webhooks/trigger_service_spec.rb @@ -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 @@ -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 @@ -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 @@ -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