Skip to content

Commit 5452514

Browse files
refactor: replace print statements with logger.warning calls
Co-Authored-By: Patched <[email protected]>
1 parent f0ec280 commit 5452514

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

patchwork/steps/FixIssue/FixIssue.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Any, Optional
55

66
from git import Repo, InvalidGitRepositoryError
7+
from patchwork.logger import logger
78
from openai.types.chat import ChatCompletionMessageParam
89

910
from patchwork.common.client.llm.aio import AioLlmClient
@@ -177,10 +178,10 @@ def run(self):
177178
modified_file["diff"] = diff
178179
except Exception as e:
179180
# Git-specific errors (untracked files, etc) - keep empty diff
180-
print(f"Note: Could not get git diff for {file}: {str(e)}")
181+
logger.warning(f"Could not get git diff for {file}: {str(e)}")
181182
except Exception as e:
182183
# General file processing errors
183-
print(f"Warning: Failed to process file {file}: {str(e)}")
184+
logger.warning(f"Failed to process file {file}: {str(e)}")
184185

185186
modified_files_with_diffs.append(modified_file)
186187

patchwork/steps/ModifyCode/ModifyCode.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import difflib
44
from pathlib import Path
55

6+
from patchwork.logger import logger
67
from patchwork.step import Step, StepStatus
78

89

@@ -128,7 +129,7 @@ def run(self) -> dict:
128129
if not diff and new_code: # If no diff but we have new code (new file)
129130
diff = f"+++ {file_path}\n{new_code}"
130131
except (OSError, IOError) as e:
131-
print(f"Warning: Failed to generate diff for {file_path}: {str(e)}")
132+
logger.warning(f"Failed to generate diff for {file_path}: {str(e)}")
132133
# Still proceed with the modification even if diff generation fails
133134
replace_code_in_file(file_path, start_line, end_line, new_code)
134135
diff = f"+++ {file_path}\n{new_code}" # Use new code as diff on error

0 commit comments

Comments
 (0)