Skip to content

Commit 2dca79c

Browse files
committed
feat: change log level for webhook triggering logs from debug to info
1 parent 123bf93 commit 2dca79c

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

lib/pact_broker/webhooks/job.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def reschedule_job?
8888
end
8989

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

lib/pact_broker/webhooks/service.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def self.trigger_webhooks pact, verification, event_name, options
122122
if webhooks.any?
123123
run_later(webhooks, pact, verification, event_name, options)
124124
else
125-
logger.debug "No enabled webhooks found for consumer \"#{pact.consumer.name}\" and provider \"#{pact.provider.name}\" and event #{event_name}"
125+
logger.info "No enabled webhooks found for consumer \"#{pact.consumer.name}\" and provider \"#{pact.provider.name}\" and event #{event_name}"
126126
end
127127
end
128128

lib/pact_broker/webhooks/trigger_service.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ def trigger_webhooks_for_new_pact(pact, webhook_options)
1414
if pact_is_new_or_newly_tagged_or_pact_has_changed_since_previous_version?(pact)
1515
webhook_service.trigger_webhooks pact, nil, PactBroker::Webhooks::WebhookEvent::CONTRACT_CONTENT_CHANGED, webhook_options
1616
else
17-
logger.debug "Pact content has not changed since previous version, not triggering webhooks for changed content"
17+
logger.info "Pact content has not changed since previous version, not triggering webhooks for changed content"
1818
end
1919
end
2020

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

@@ -60,7 +60,7 @@ def print_debug_messages(changed_pacts)
6060
end
6161
end
6262
end
63-
logger.debug("Webhook triggered for the following reasons: #{messages.join(',')}" )
63+
logger.info("Webhook triggered for the following reasons: #{messages.join(',')}" )
6464
end
6565
end
6666
end

spec/lib/pact_broker/webhooks/service_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ module Webhooks
186186
end
187187

188188
it "logs that no webhook was found" do
189-
expect(logger).to receive(:debug).with(/No enabled webhooks found/)
189+
expect(logger).to receive(:info).with(/No enabled webhooks found/)
190190
subject
191191
end
192192
end

spec/lib/pact_broker/webhooks/trigger_service_spec.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module Webhooks
5050
include_examples "triggering a contract_content_changed event"
5151

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

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

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

128128
it "logs the reason why it triggered the contract_content_changed event" do
129-
expect(logger).to receive(:debug).with(/version 1.2.3 has been updated with new content/)
129+
expect(logger).to receive(:info).with(/version 1.2.3 has been updated with new content/)
130130
subject
131131
end
132132
end

0 commit comments

Comments
 (0)