这是indexloc提供的服务,不要输入任何密码
Skip to content

feat: Talker Chopper logger #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 87 commits into from
Jul 27, 2025
Merged

Conversation

techouse
Copy link
Contributor

@techouse techouse commented Apr 17, 2025

This pull request introduces a new package, talker_chopper_logger, which provides logging capabilities for the Chopper HTTP client. It includes the initial implementation of the package, documentation updates, and supporting configuration files. Below is a summary of the most important changes:

New Package Implementation:

  • Added the talker_chopper_logger package with an initial version (1.0.0), including its core functionality, settings, and customization options (packages/talker_chopper_logger/README.md, packages/talker_chopper_logger/CHANGELOG.md, packages/talker_chopper_logger/LICENSE, [1] [2] [3].
/// Example usage
final client = ChopperClient(
  /// ... other chopper settings
  interceptors: [
    TalkerChopperLogger(
      settings: const TalkerChopperLoggerSettings(
        printRequestHeaders: true,
        printResponseHeaders: true,
        printResponseMessage: true,
      ),
    ),
  ],
);

Documentation and Workflow Updates:

  • Updated the main README.md to include talker_chopper_logger as a supported package and added usage instructions for integrating it with Chopper (README.md, [1] [2] [3].
  • Added a dedicated README.md for the talker_chopper_logger package, detailing its features, usage, and customization options (packages/talker_chopper_logger/README.md, packages/talker_chopper_logger/README.mdR1-R140).
  • Created a GitHub Actions workflow for building, testing, and checking code coverage for the new package (.github/workflows/talker_chopper_logger.yaml, .github/workflows/talker_chopper_logger.yamlR1-R64).

Example Project:

  • Added a Flutter example project for demonstrating the usage of talker_chopper_logger, including relevant configuration files and documentation (packages/talker_chopper_logger/example/README.md, [1] [2] [3] [4].

Linting and Analysis:

  • Configured analysis_options.yaml files for both the main package and the example project to enforce coding standards and exclude generated files from analysis (packages/talker_chopper_logger/analysis_options.yaml, [1] packages/talker_chopper_logger/example/analysis_options.yaml, [2].

Summary by Sourcery

Add Talker Chopper Logger package to support logging for Chopper HTTP client

New Features:

  • Introduced a new package talker_chopper_logger for logging Chopper HTTP client requests, responses, and errors
  • Added comprehensive logging capabilities with customizable settings
  • Implemented support for printing request/response headers, data, and curl commands
  • Integrated with existing Talker logging infrastructure

CI:

  • Added GitHub Actions workflow for building, testing, and checking code coverage for the new package

Documentation:

  • Updated main README.md to include talker_chopper_logger in the list of supported packages
  • Added dedicated README.md for the new package with usage instructions and customization options
  • Created comprehensive documentation for logging settings and features

Tests:

  • Added unit tests for request, response, and error logging
  • Implemented test coverage for various logging scenarios and edge cases

Chores:

  • Created project structure for the new package
  • Added Makefile for project management
  • Configured analysis options and linting
  • Set up GitHub Actions workflow for CI

Copy link
Contributor

sourcery-ai bot commented Apr 17, 2025

Reviewer's Guide by Sourcery

This pull request introduces the talker_chopper_logger package, providing logging capabilities for the Chopper HTTP client. It includes the initial implementation of the package, documentation updates, and supporting configuration files. The package offers customizable logging settings, filtering, and integration with existing Talker instances.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Introduction of the talker_chopper_logger package for logging Chopper HTTP client requests and responses.
  • Created the talker_chopper_logger package with core functionality, settings, and customization options.
  • Added a Makefile for project management tasks.
  • Included a .gitignore file to exclude unnecessary files from version control.
  • Created a GitHub Actions workflow for building, testing, and checking code coverage.
  • Configured analysis_options.yaml files for the main package and the example project.
  • Added a Flutter example project demonstrating package usage.
packages/talker_chopper_logger/README.md
packages/talker_chopper_logger/CHANGELOG.md
packages/talker_chopper_logger/LICENSE
packages/talker_chopper_logger/Makefile
packages/talker_chopper_logger/.gitignore
.github/workflows/talker_chopper_logger.yaml
packages/talker_chopper_logger/analysis_options.yaml
packages/talker_chopper_logger/example/README.md
packages/talker_chopper_logger/example/analysis_options.yaml
packages/talker_chopper_logger/test/logs_test.dart
packages/talker_chopper_logger/test/logger_test.dart
packages/talker_chopper_logger/test/settings_test.dart
packages/talker_chopper_logger/lib/chopper_logs.dart
packages/talker_chopper_logger/lib/curl_request.dart
packages/talker_chopper_logger/lib/talker_chopper_logger_settings.dart
packages/talker_chopper_logger/lib/talker_chopper_logger_interceptor.dart
packages/talker_chopper_logger/lib/talker_chopper_logger.dart
packages/talker_chopper_logger/pubspec.yaml
packages/talker_chopper_logger/pubspec_overrides.yaml
packages/talker_chopper_logger/CHANGELOG.md
packages/talker_chopper_logger/LICENSE
packages/talker_chopper_logger/tool/makefile_helpers.sh
Update the main README.md to include talker_chopper_logger as a supported package.
  • Added talker_chopper_logger to the list of supported packages in the main README.md.
  • Included usage instructions for integrating talker_chopper_logger with Chopper.
README.md
Update utility scripts to include the new package.
  • Modified pub_get_all.sh to include the new package.
  • Modified publish_all.sh to include the new package.
  • Modified test.sh to include the new package.
utils/pub_get_all.sh
utils/publish_all.sh
utils/test.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@techouse techouse marked this pull request as ready for review April 18, 2025 11:49
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @techouse - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a section about error handling to the README.md to guide users on how to interpret and handle errors logged by the interceptor.
  • The example project could benefit from a more detailed README.md explaining the purpose of each service and model.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@techouse
Copy link
Contributor Author

@Frezyx please throw an eye on this, once you can, and let me know if you want any changes.

P.S. I am one of the maintainers of Chopper. 👨‍💻

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @techouse - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a section about error handling and retry mechanisms to the README.
  • The example app could benefit from a UI to toggle the logger settings to demonstrate the customization options.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

…opperResponseLog classes for enhanced readability
…rErrorLog, ChopperRequestLog, and ChopperResponseLog classes for improved structure
@techouse
Copy link
Contributor Author

@sourcery-ai review

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @techouse - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a section about error handling in the README.md to guide users on how to interpret and respond to logged errors.
  • The example app could benefit from a more complex real-world scenario to better showcase the logger's capabilities.
Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@techouse
Copy link
Contributor Author

@Frezyx this is now dev complete with 100% test coverage. Please review it, once you have time.

@Frezyx Frezyx added enhancement New feature or request addons Related to addons/bridge packages like dio_logger and bloc_logger labels May 1, 2025
@codecov-commenter
Copy link

codecov-commenter commented May 1, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1ed15ab) to head (651757a).
⚠️ Report is 50 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           master      #355      +/-   ##
===========================================
+ Coverage   98.63%   100.00%   +1.36%     
===========================================
  Files           3         6       +3     
  Lines         146       251     +105     
===========================================
+ Hits          144       251     +107     
+ Misses          2         0       -2     

☔ 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.

@Frezyx Frezyx added awaiting On the list for consideration or merge v5 Related to new package big release 5.0.0 labels May 2, 2025
@techouse
Copy link
Contributor Author

@Frezyx I suggest you squash-merge this commit so that it doesn't flood the master commit log.

@Frezyx Frezyx merged commit bb0eb21 into Frezyx:master Jul 27, 2025
1 check passed
@Frezyx
Copy link
Owner

Frezyx commented Jul 27, 2025

@techouse, thank you so much! I really appreciate your work. It's great! ❤️

@techouse techouse deleted the feat/talker-chopper-logger branch July 27, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addons Related to addons/bridge packages like dio_logger and bloc_logger awaiting On the list for consideration or merge enhancement New feature or request v5 Related to new package big release 5.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants