Route library-internal warnings through logging (#15)#106
Merged
Conversation
Five primitive/registry call sites used `print()` for warnings: RuleSet.add_rule, Bin.transform, EnumToEnum.transform, and two paths inside Reduce.onehot_reduction. These polluted stdout (which the CLI also uses for harmonized CSV output when piped), couldn't be silenced, and lacked any way to filter by severity. Replace with module-level `logging.getLogger(__name__).warning(...)`. The two user-facing `print()` calls in `cli.py` and `harmonize.py` are left alone — those are intentional progress output for the CLI user and belong on stdout. Resolves #15. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Closes #15. Library-internal warnings now use the `logging` module instead of `print()`, so they no longer pollute stdout (which matters because the CLI streams harmonized CSV through stdout when piped) and can be filtered by severity.
Five call sites changed to `logger.warning(...)`:
Each module declares `logger = logging.getLogger(name)` at top level, so callers can configure or suppress these warnings per-module if they want.
Deliberately left as `print()`
Those are direct CLI ergonomics, not library logging events.
Test plan
🤖 Generated with Claude Code