From 1753cd261a9bf047da275bbe3807f8aa769c3739 Mon Sep 17 00:00:00 2001 From: sachin-sandhu Date: Mon, 28 Oct 2024 07:10:49 -0400 Subject: [PATCH] trace logging --- common/lib/dependabot/pull_request_creator.rb | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/common/lib/dependabot/pull_request_creator.rb b/common/lib/dependabot/pull_request_creator.rb index 533f479a818..13e30cb470a 100644 --- a/common/lib/dependabot/pull_request_creator.rb +++ b/common/lib/dependabot/pull_request_creator.rb @@ -223,6 +223,12 @@ def initialize(source:, base_commit:, dependencies:, files:, credentials:, @pr_message_max_length = pr_message_max_length @pr_message_encoding = pr_message_encoding + if trace_log? + Dependabot.logger.info( + "Dependabot::PullRequestCreator::initialize : #{existing_branches}" + ) + end + check_dependencies_have_previous_version end @@ -240,6 +246,12 @@ def check_dependencies_have_previous_version # then convert to that sig { returns(T.untyped) } def create + if trace_log? + Dependabot.logger.info( + "Dependabot::PullRequestCreator::create" + ) + end + case source.provider when "github" then github_creator.create when "gitlab" then gitlab_creator.create @@ -269,6 +281,12 @@ def require_up_to_date_base? sig { returns(Dependabot::PullRequestCreator::Github) } def github_creator + if trace_log? + Dependabot.logger.info( + "Dependabot::PullRequestCreator::create" + ) + end + Github.new( source: source, branch_name: branch_namer.new_branch_name, @@ -396,8 +414,8 @@ def message sig { returns(Dependabot::PullRequestCreator::BranchNamer) } def branch_namer - if Dependabot::Experiments.enabled?(:dedup_branch_names) && existing_branches - Dependabot.logger.debug( + if trace_log? + Dependabot.logger.info( "Dependabot::PullRequestCreator::branch_namer : #{existing_branches}" ) end @@ -432,6 +450,14 @@ def labeler ), T.nilable(Dependabot::PullRequestCreator::Labeler) ) + + if trace_log? + Dependabot.logger.info( + "Dependabot::PullRequestCreator::branch_namer : #{existing_branches}" + ) + end + + @labeler end sig { returns(T::Boolean) } @@ -443,5 +469,10 @@ def includes_security_fixes? def requirements_changed?(dependency) (dependency.requirements - T.must(dependency.previous_requirements)).any? end + + sig { returns(T::Boolean) } + def trace_log? + Dependabot::Experiments.enabled?(:dedup_branch_names) + end end end