refactor(logging): replace package print statements with module-level… - #70
Open
d-lazenby wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors package modules to use module-level logging instead of print(), aligning output with the CLI’s logging configuration and enabling tests to assert warnings via log capture.
Changes:
- Replaced
print()calls in package modules withlogger.info(...),logger.warning(...),logger.error(...), andlogger.exception(...). - Updated discovery warning test to assert via
caploginstead ofcapsys. - Added module-level
logger = logging.getLogger(__name__)to affected modules.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_discovery.py | Switches unmanaged-module warning assertions from stdout capture to log capture. |
| src/update_tf_modules/discovery.py | Uses logger.warning(...) for unmanaged-module warnings instead of print(). |
| src/update_tf_modules/clients/github_api.py | Replaces GitHub client error print() calls with structured logger calls. |
| src/update_tf_modules/clients/registry_api.py | Replaces Registry client error print() calls with structured logger calls. |
| src/update_tf_modules/updaters/github_source.py | Logs GitHub module update messages via logger.info(...) instead of print(). |
| src/update_tf_modules/updaters/registry_source.py | Logs registry module update messages via logger.info(...) instead of print(). |
Suppressed comments (1)
src/update_tf_modules/clients/registry_api.py:61
- There is trailing whitespace on the blank line after the exception handler (line 59). This can cause lint failures and noisy diffs.
return None
def semver_key(version: str) -> tuple[tuple[int, int | str], ...]:
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+88
to
+90
| logger.warning( | ||
| "Terraform modules were found in the repo but are not represented in the manifest:" | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use module-level logging instead of print in package modules
Closes #61
Summary