Skip to content

Conversation

@ognis1205
Copy link
Contributor

@ognis1205 ognis1205 commented Nov 21, 2025

Description

This PR migrates the logging implementation from env_logger to tracing.

The migration preserves the existing log format while extending it to include span information, enabling more structured and contextual logging without changing the default user experience.

Motivation and Context

This change is motivated by the following discussion and issues:

The goal is to modernize git-cliff's logging infrastructure by adopting tracing, while maintaining backward compatibility and avoiding unnecessary complexity in the core crate.

What Has Changed

  • The logger has been updated to emit spans in a format consistent with the existing log output.
  • Span instrumentation is applied only to methods that affect the changelog generator's semantics (e.g. changelog, release, and commit processing).
  • git-cliff-core now depends on tracing behind a feature flag.
    • When the feature is disabled, the behavior is unchanged and only the existing log output is produced.
    • When the feature is enabled, spans are created and included in the output.
  • Remote metadata progress reporting has been fully migrated to a tracing-based implementation using tracing-indicatif.
  • The progress bar implementation is intentionally kept simple.
    • While richer progress reporting is possible with tracing, implementing such behavior cleanly would require API changes outside of git-cliff-core.
    • Given the current API design, this PR avoids introducing additional complexity and leaves room for future design discussions.

How Has This Been Tested?

  • Existing unit tests were run.
  • Logging output was verified manually.

Screenshots / Logs (if applicable)

N/A

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have formatted the code with rustfmt.
  • I checked the lints with clippy.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@ognis1205 ognis1205 marked this pull request as draft November 21, 2025 19:32
@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 0% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 43.69%. Comparing base (97b0322) to head (b53b100).

Files with missing lines Patch % Lines
git-cliff/src/logger.rs 0.00% 72 Missing ⚠️
git-cliff-core/src/changelog.rs 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1308      +/-   ##
==========================================
+ Coverage   43.40%   43.69%   +0.30%     
==========================================
  Files          23       23              
  Lines        2247     2232      -15     
==========================================
  Hits          975      975              
+ Misses       1272     1257      -15     
Flag Coverage Δ
unit-tests 43.69% <0.00%> (+0.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@orhun
Copy link
Owner

orhun commented Nov 21, 2025

10 seconds ago I was happy that my GitHub notifications were clear and then Shingo comes in with a crazy PR!!!!!

+0 additions -0 deletions though. Love it. LGTM

@orhun orhun added this to the 2.12.0 milestone Dec 14, 2025
@orhun
Copy link
Owner

orhun commented Dec 14, 2025

planning to do any progress on this soon? (added to 2.12.0 milestone)

@ognis1205
Copy link
Contributor Author

planning to do any progress on this soon? (added to 2.12.0 milestone)

Yeah, I'm planning to open a PR later this week.
Does that timeline work for the 2.12.0 milestone?

@orhun
Copy link
Owner

orhun commented Dec 15, 2025

yup, 2.12.0 will happen in 2026 :)
so we have a whole year!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

@ognis1205
Copy link
Contributor Author

Sorry for the delay. I'll start working on this PR today.

@orhun
Copy link
Owner

orhun commented Dec 20, 2025

No worries at all!

@ognis1205 ognis1205 force-pushed the feat/migrate-to-tracing branch from 5bb0f7b to f6b930d Compare December 20, 2025 21:30
@ognis1205 ognis1205 force-pushed the feat/migrate-to-tracing branch from f6b930d to b273940 Compare January 3, 2026 19:54
@ognis1205 ognis1205 force-pushed the feat/migrate-to-tracing branch from b273940 to b1e9f80 Compare January 12, 2026 17:02
@ognis1205 ognis1205 marked this pull request as ready for review January 13, 2026 13:44
@ognis1205 ognis1205 requested a review from orhun as a code owner January 13, 2026 13:44
@ognis1205
Copy link
Contributor Author

This is ready for review now @orhun .

I consider this a first draft, and there are likely areas open for discussion. When you have time, I'd really appreciate your thoughts and feedback.

Copy link
Contributor Author

@ognis1205 ognis1205 left a comment

Choose a reason for hiding this comment

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

TODO:

  • Replace all ASCII color codes with owo_colors.
  • Consider how to handle Windows and non-TTY environments (this may also have been an issue in the previous implementation).

@ognis1205 ognis1205 force-pushed the feat/migrate-to-tracing branch from b2940eb to 71cc1a4 Compare January 14, 2026 09:31
@ognis1205 ognis1205 force-pushed the feat/migrate-to-tracing branch from 75b4d8d to b53b100 Compare January 16, 2026 12:36
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.

3 participants