Skip to content

refactor(logging): replace package print statements with module-level… - #70

Open
d-lazenby wants to merge 1 commit into
mainfrom
61-replace-print-statements-with-logger-calls-across-package-modules
Open

refactor(logging): replace package print statements with module-level…#70
d-lazenby wants to merge 1 commit into
mainfrom
61-replace-print-statements-with-logger-calls-across-package-modules

Conversation

@d-lazenby

Copy link
Copy Markdown
Contributor

Use module-level logging instead of print in package modules

Closes #61

Summary

  • Replaces package print statements with module-level logger calls for consistent logging behavior and formatting.
  • Updates discovery warning assertions to use log capture.
  • Keeps CLI fallback error prints unchanged.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 with logger.info(...), logger.warning(...), logger.error(...), and logger.exception(...).
  • Updated discovery warning test to assert via caplog instead of capsys.
  • 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:"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace print statements with logger calls across package modules

2 participants