Skip to content

fix: route clip_manager logging through module logger#154

Merged
nikopueringer merged 1 commit intonikopueringer:mainfrom
shezmic:fix/clip-manager-logging
Mar 14, 2026
Merged

fix: route clip_manager logging through module logger#154
nikopueringer merged 1 commit intonikopueringer:mainfrom
shezmic:fix/clip-manager-logging

Conversation

@shezmic
Copy link
Contributor

@shezmic shezmic commented Mar 13, 2026

What changed

Two logging consistency fixes in clip_manager.py, both surgical — no logic changes.

1. ClipEntry.find_assets()logging.warning()logger.warning()

The module defines logger = logging.getLogger(__name__) at line 26, but two call sites in find_assets() bypass it, writing directly to the root logger via logging.warning():

  • Empty AlphaHint directory warning (was line 153)
  • AlphaHint directory with no valid media files warning (was line 164)

These now use the module logger, so they respect the caller's log configuration and show the correct module name (clip_manager) in log output.

2. scan_clips()print()logger

The INVALID OR SKIPPED CLIPS summary and the all-valid confirmation used raw print(), which:

  • Bypasses log level filtering entirely
  • Is invisible to any log handler when clip_manager is used as a library
  • Cannot be suppressed without redirecting stdout

Replaced with logger.warning() per invalid entry and logger.info() for the all-valid case.

Why it was needed

When clip_manager is imported and called programmatically (e.g. from corridorkey_cli.py), print() output goes directly to stdout and cannot be filtered or redirected by the caller's logging setup. The logging.warning() calls had the same issue — they wrote to the root logger, not the module logger, making them harder to trace and impossible to suppress per-module.

How to verify

uv run pytest          # 221 passed, 2 skipped
uv run ruff check clip_manager.py   # All checks passed

No behaviour change in interactive use — log output appears identically at WARNING/INFO level when the root handler is configured (as corridorkey_cli.py does via _configure_environment()).

Two categories of print/logging fixes in clip_manager.py:

1. ClipEntry.find_assets() used logging.warning() (root logger) instead
   of the module-level logger = logging.getLogger(__name__) at line 26.
   Fixed at two call sites (empty AlphaHint dir, no valid media files).

2. scan_clips() used raw print() for its INVALID OR SKIPPED CLIPS
   summary and the all-valid confirmation. These bypass the logging
   system entirely — invisible to log level filtering and log handlers
   when clip_manager is used as a library.
   Replaced with logger.warning() per entry and logger.info() for the
   all-valid case.

No logic changes. 221 tests pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nikopueringer nikopueringer merged commit 8709ae2 into nikopueringer:main Mar 14, 2026
3 checks passed
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.

2 participants