Skip to content

Commit

Permalink
refactor: replace print statements with logger.warning calls
Browse files Browse the repository at this point in the history
Co-Authored-By: Patched <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and patched-admin committed Jan 14, 2025
1 parent f0ec280 commit 5452514
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions patchwork/steps/FixIssue/FixIssue.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Any, Optional

from git import Repo, InvalidGitRepositoryError
from patchwork.logger import logger
from openai.types.chat import ChatCompletionMessageParam

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

modified_files_with_diffs.append(modified_file)

Expand Down
3 changes: 2 additions & 1 deletion patchwork/steps/ModifyCode/ModifyCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import difflib
from pathlib import Path

from patchwork.logger import logger
from patchwork.step import Step, StepStatus


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

0 comments on commit 5452514

Please sign in to comment.