Skip to content

Improve terminal logging (grouped + Rich + --no-color)#960

Merged
spoorcc merged 6 commits intomainfrom
patch-logging
Jan 30, 2026
Merged

Improve terminal logging (grouped + Rich + --no-color)#960
spoorcc merged 6 commits intomainfrom
patch-logging

Conversation

@spoorcc
Copy link
Contributor

@spoorcc spoorcc commented Jan 16, 2026

Summary by CodeRabbit

  • New Features

    • Added --no-color flag and NO_COLOR support to disable colored output.
    • Patch operations now surface an encoding-warning indicator when a patch isn’t UTF‑8.
  • Refactor

    • Replaced logging with Rich for richer, consistent console output.
    • Output reflowed to hierarchical block-style messages with improved status indicators and progress handling.
  • Documentation

    • Updated third‑party license references to reflect the new output library.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

Walkthrough

Replaced coloredlogs/Halo/colorama with Rich-based logging, added NO_COLOR handling, moved console/logger initialization to runtime, introduced DLogger enhancements, changed many CLI output formats to two-line project blocks, and made apply_patch return a PatchResult including encoding warnings.

Changes

Cohort / File(s) Summary
Logging infrastructure
dfetch/log.py
Replaced legacy libs with Rich. Added make_console, configure_root_logger, setup_root, get_logger, configure_external_logger, increase_verbosity. Reworked DLogger (new print_report_line, print_warning_line, print_title, print_info_field, status, reset_projects, styled warning/error) and added ExtLogFilter.
CLI / runtime init
dfetch/__main__.py
Moved logger/console setup into run(), added --no-color, run(argv: Sequence[str], console: Optional[Console]=None), create Console/DLogger at runtime and call logger.print_title().
Command modules
dfetch/commands/...
dfetch/commands/common.py, dfetch/commands/environment.py, dfetch/commands/validate.py
Switched logging channels: print_info_lineprint_report_line, consolidate warnings using print_warning_line, adjusted where headers are emitted (per-project).
Project / spinners
dfetch/project/subproject.py
Removed Halo spinners; use logger.status() context manager. Updated info/warning calls to new DLogger methods and adjusted patch-related messages/encoding handling.
Patch API
dfetch/vcs/patch.py
Added @dataclass PatchResult(encoding_warning: bool=False). apply_patch() now returns PatchResult and sets encoding warning via return value instead of logging directly.
Tests & test harness
features/steps/generic_steps.py, features/environment.py, tests/test_report.py
Integrated Rich Console capture into tests, added temporary_env and normalize_lines, reset DLogger state in tests, and updated assertions to print_report_line.
Feature expectations
features/*.feature (many files; see list)
Updated expected output: single-line project status -> two-line block (project header line, then > prefixed detail line). Reflowed dependency/warning blocks to hierarchical/indented format.
Docs & config
CHANGELOG.rst, doc/legal.rst, pyproject.toml, doc/_ext/.../.dfetch_data.yaml
Changelog entries for Rich/NO_COLOR, replaced references/licenses for Rich, removed coloredlogs/halo/colorama deps and added rich==14.2.0, updated metadata hash.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant CLI as CLI (dfetch.__main__)
participant Log as Log (dfetch.log)
participant Command as Command (commands / DLogger)
participant Subproj as SubProject
participant VCS as VCS (apply_patch)
CLI->>Log: make_console(no_color) / configure_root_logger
CLI->>Command: run(argv) with Console -> setup_root / get_logger
Command->>Subproj: invoke update/fetch -> logger.status(...)
Subproj->>VCS: apply_patch(...) -> returns PatchResult(encoding_warning)
VCS-->>Subproj: PatchResult
Subproj->>Command: logger.print_report_line / print_warning_line

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested labels

development, UX, enhancement

Suggested reviewers

  • ben-edna
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title accurately summarizes the main changes: improving terminal logging with grouped output, Rich library integration, and a --no-color flag.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@spoorcc
Copy link
Contributor Author

spoorcc commented Jan 28, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@spoorcc spoorcc marked this pull request as ready for review January 28, 2026 22:11
@spoorcc
Copy link
Contributor Author

spoorcc commented Jan 28, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@spoorcc spoorcc changed the title Patch-logging Improve terminal logging (grouped + Rich + --no-color) Jan 28, 2026
@spoorcc spoorcc merged commit d571b9e into main Jan 30, 2026
38 checks passed
@spoorcc spoorcc deleted the patch-logging branch January 30, 2026 20:14
@coderabbitai coderabbitai bot mentioned this pull request Feb 9, 2026
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.

1 participant