Skip to content

Commit 035d7d2

Browse files
committed
Fixed logs that were not printing out the variables after loguru migration
1 parent df95685 commit 035d7d2

3 files changed

Lines changed: 26 additions & 26 deletions

File tree

diff_poetry_lock/github.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,33 @@ def post_comment(self, comment: str) -> None:
4343
logger.debug("No PR number available; skipping comment post")
4444
return
4545

46-
logger.debug("Posting comment to PR #%s", self.s.pr_num)
46+
logger.debug("Posting comment to PR #{}", self.s.pr_num)
4747
r = self.session.post(
4848
f"{self.s.api_url}/repos/{self.s.repository}/issues/{self.s.pr_num}/comments",
4949
headers={"Authorization": f"token {self.s.token}", "Accept": "application/vnd.github+json"},
5050
json={"body": f"{MAGIC_COMMENT_IDENTIFIER}{comment}"},
5151
timeout=10,
5252
)
53-
logger.debug("Response status: %s", r.status_code)
53+
logger.debug("Response status: {}", r.status_code)
5454
r.raise_for_status()
5555

5656
def update_comment(self, comment_id: int, comment: str) -> None:
57-
logger.debug("Updating comment %s", comment_id)
57+
logger.debug("Updating comment {}", comment_id)
5858
r = self.session.patch(
5959
f"{self.s.api_url}/repos/{self.s.repository}/issues/comments/{comment_id}",
6060
headers={"Authorization": f"token {self.s.token}", "Accept": "application/vnd.github+json"},
6161
json={"body": f"{MAGIC_COMMENT_IDENTIFIER}{comment}"},
6262
timeout=10,
6363
)
64-
logger.debug("Response status: %s", r.status_code)
64+
logger.debug("Response status: {}", r.status_code)
6565
r.raise_for_status()
6666

6767
def list_comments(self) -> list[GithubComment]:
6868
if not self.s.pr_num:
6969
logger.debug("No PR number available; returning empty comment list")
7070
return []
7171

72-
logger.debug("Fetching comments for PR #%s", self.s.pr_num)
72+
logger.debug("Fetching comments for PR #{}", self.s.pr_num)
7373
all_comments, comments, page = [], None, 1
7474
while comments is None or len(comments) == 100:
7575
r = self.session.get(
@@ -86,7 +86,7 @@ def list_comments(self) -> list[GithubComment]:
8686
return [c for c in all_comments if c.is_bot_comment()]
8787

8888
def get_file(self, ref: str) -> Response:
89-
logger.debug("Fetching %s from ref %s", self.s.lockfile_path, ref)
89+
logger.debug("Fetching {} from ref {}", self.s.lockfile_path, ref)
9090

9191
r = self.session.get(
9292
f"{self.s.api_url}/repos/{self.s.repository}/contents/{self.s.lockfile_path}",
@@ -95,27 +95,27 @@ def get_file(self, ref: str) -> Response:
9595
timeout=10,
9696
stream=True,
9797
)
98-
logger.debug("Response status: %s", r.status_code)
98+
logger.debug("Response status: {}", r.status_code)
9999

100100
if r.status_code == 404:
101101
raise FileNotFoundError(self.s.lockfile_path) from RepoFileRetrievalError(self.s.repository, ref)
102102
r.raise_for_status()
103103
return r
104104

105105
def delete_comment(self, comment_id: int) -> None:
106-
logger.debug("Deleting comment %s", comment_id)
106+
logger.debug("Deleting comment {}", comment_id)
107107
r = self.session.delete(
108108
f"{self.s.api_url}/repos/{self.s.repository}/issues/comments/{comment_id}",
109109
headers={"Authorization": f"token {self.s.token}", "Accept": "application/vnd.github+json"},
110110
)
111-
logger.debug("Response status: %s", r.status_code)
111+
logger.debug("Response status: {}", r.status_code)
112112
r.raise_for_status()
113113

114114
def find_pr_for_branch(self, branch_ref: str) -> str:
115115
"""Find open PR number for a given branch ref (e.g., 'refs/heads/deps-update').
116116
Returns PR number as string, or empty string if not found."""
117117
branch = branch_ref.replace("refs/heads/", "")
118-
logger.debug("Looking for open PR for branch %s", branch)
118+
logger.debug("Looking for open PR for branch {}", branch)
119119

120120
org = self.s.repository.split("/")[0]
121121
head = f"{org}:{branch}"
@@ -126,16 +126,16 @@ def find_pr_for_branch(self, branch_ref: str) -> str:
126126
headers={"Authorization": f"token {self.s.token}", "Accept": "application/vnd.github+json"},
127127
timeout=10,
128128
)
129-
logger.debug("Response status: %s", r.status_code)
129+
logger.debug("Response status: {}", r.status_code)
130130
r.raise_for_status()
131131

132132
pulls = r.json()
133133
if pulls and len(pulls) > 0:
134134
pr_num = str(pulls[0]["number"])
135-
logger.debug("Found open PR #%s", pr_num)
135+
logger.debug("Found open PR #{}", pr_num)
136136
return pr_num
137137

138-
logger.debug("No open PR found for branch %s", branch)
138+
logger.debug("No open PR found for branch {}", branch)
139139
return ""
140140

141141
def upsert_comment(self, existing_comment: GithubComment | None, comment: str | None) -> None:

diff_poetry_lock/run_poetry.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,27 +116,27 @@ def main() -> None:
116116
def do_diff(settings: Settings) -> None:
117117
api = GithubApi(settings)
118118

119-
logger.debug("Starting diff with base_ref=%s ref=%s", settings.base_ref, settings.ref)
119+
logger.debug("Starting diff with base_ref={} ref={}", settings.base_ref, settings.ref)
120120

121121
logger.debug("Loading base lockfile...")
122122
base_packages = load_lockfile(api, settings.base_ref)
123-
logger.debug("Loaded %s base packages", len(base_packages))
123+
logger.debug("Loaded {} base packages", len(base_packages))
124124

125125
logger.debug("Loading head lockfile...")
126126
head_packages = load_lockfile(api, settings.ref)
127-
logger.debug("Loaded %s head packages", len(head_packages))
127+
logger.debug("Loaded {} head packages", len(head_packages))
128128

129129
logger.debug("Computing diff...")
130130
packages = diff(base_packages, head_packages)
131131
summary = format_comment(packages)
132132

133133
if summary:
134-
logger.debug("Generated summary with %s characters", len(summary))
135-
logger.debug("=== DIFF SUMMARY ===\n%s\n====================", summary)
134+
logger.debug("Generated summary with {} characters", len(summary))
135+
logger.debug("\n=== DIFF SUMMARY ===\n{}\n====================\n", summary)
136136
# pr_num could be lazy lookup
137137
pr_number = settings.pr_num
138138
if pr_number:
139-
logger.debug("Posting comment to PR #%s", pr_number)
139+
logger.debug("Posting comment to PR #{}", pr_number)
140140
post_comment(api, summary)
141141
else:
142142
logger.info("Skipping comment post since no PR number is available.")

diff_poetry_lock/settings.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ def __init__(self, **values: Any) -> None: # noqa: ANN401
6161
super().__init__(**values)
6262
# Calculate base_ref from repo_branch
6363
self.base_ref = f"refs/heads/{self.repo_branch}"
64-
logger.debug("VelaSettings calculated base_ref=%s from repo_branch=%s", self.base_ref, self.repo_branch)
65-
logger.debug("VelaSettings ref=%s", self.ref)
66-
logger.debug("VelaSettings event_name=%s", self.event_name)
64+
logger.debug("VelaSettings calculated base_ref={} from repo_branch={}", self.base_ref, self.repo_branch)
65+
logger.debug("VelaSettings ref={}", self.ref)
66+
logger.debug("VelaSettings event_name={}", self.event_name)
6767

6868
def set_pr_lookup_service(self, service: PrLookupService) -> None:
6969
self._pr_lookup_service = service
@@ -77,11 +77,11 @@ def pr_num(self) -> str: # type: ignore[override]
7777
logger.debug("PR lookup requested before service configured; returning empty string")
7878
return ""
7979

80-
logger.debug("VelaSettings.pr_num looking up PR for branch %s", self.ref)
80+
logger.debug("VelaSettings.pr_num looking up PR for branch {}", self.ref)
8181
pr_num = self._pr_lookup_service.find_pr_for_branch(self.ref)
8282
self._pr_num_cached = pr_num
8383
if pr_num:
84-
logger.debug("VelaSettings.pr_num found PR #%s", pr_num)
84+
logger.debug("VelaSettings.pr_num found PR #{}", pr_num)
8585
else:
8686
logger.debug("VelaSettings.pr_num found no open PR")
8787
return pr_num
@@ -145,10 +145,10 @@ def determine_and_load_settings() -> Settings:
145145
if settings_type := find_settings_for_environment():
146146
try:
147147
settings = settings_type()
148-
logger.debug("Successfully loaded settings using %s", settings_type.__name__)
148+
logger.debug("Successfully loaded settings using {}", settings_type.__name__)
149149
return settings # noqa: TRY300
150150
except Exception:
151-
logger.exception("Error loading settings for %s", settings_type.__name__)
151+
logger.exception("Error loading settings for {}", settings_type.__name__)
152152
raise
153153

154154
raise CiNotImplemented

0 commit comments

Comments
 (0)