feat: Talker http logger v1.0.0#362
Conversation
# Conflicts: # packages/talker_http_logger/pubspec.yaml
Reviewer's GuideThis pull request refactors the Sequence Diagram for HTTP Request Interception and LoggingsequenceDiagram
participant Client
participant TalkerHttpLogger
participant Talker
participant HttpRequestLog
participant HttpResponseLog
participant HttpErrorLog
Client->>TalkerHttpLogger: makeRequest(request)
activate TalkerHttpLogger
TalkerHttpLogger->>TalkerHttpLogger: Check settings (enabled, filters)
alt Request Logging Enabled
TalkerHttpLogger->>TalkerHttpLogger: Add timestamp header (if needed)
TalkerHttpLogger->>HttpRequestLog: new HttpRequestLog(request, settings)
activate HttpRequestLog
HttpRequestLog-->>TalkerHttpLogger: requestLog
deactivate HttpRequestLog
TalkerHttpLogger->>Talker: logCustom(requestLog)
end
TalkerHttpLogger-->>Client: modifiedRequest
deactivate TalkerHttpLogger
Note right of Client: Request sent to network...
Client->>TalkerHttpLogger: receiveResponse(response)
activate TalkerHttpLogger
TalkerHttpLogger->>TalkerHttpLogger: Check settings (enabled, filters)
alt Response is Success (status < 400)
TalkerHttpLogger->>HttpResponseLog: new HttpResponseLog(response, settings)
activate HttpResponseLog
HttpResponseLog-->>TalkerHttpLogger: responseLog
deactivate HttpResponseLog
TalkerHttpLogger->>Talker: logCustom(responseLog)
else Response is Error (status >= 400)
TalkerHttpLogger->>HttpErrorLog: new HttpErrorLog(response, settings)
activate HttpErrorLog
HttpErrorLog-->>TalkerHttpLogger: errorLog
deactivate HttpErrorLog
TalkerHttpLogger->>Talker: logCustom(errorLog)
end
TalkerHttpLogger-->>Client: response
deactivate TalkerHttpLogger
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #362 +/- ##
===========================================
+ Coverage 98.61% 100.00% +1.38%
===========================================
Files 3 7 +4
Lines 144 212 +68
===========================================
+ Hits 142 212 +70
+ Misses 2 0 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey @techouse - I've reviewed your changes - here's some feedback:
- Review the necessity of the newly added dependencies (
equatable,meta,http_parser,qs_dart). - Ensure the new file structure with specialized classes remains easy to navigate and maintain.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Hey @techouse - I've reviewed your changes - here's some feedback:
- Consider moving internal implementation files (like curl_request.dart, http_error_log.dart, response_time.dart, etc.) into a
lib/srcdirectory to keep the public API surface cleaner.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@Frezyx this addresses #325 and is now dev complete with 100% coverage 😊 I have added quite a few more features, like request/response filtering etc. Throw an eye on it once you can. There are a few caveats with the http_interceptor package though, namely no error interception (like Dio or Chopper), although I have submitted a PR addressing this CodingAleCR/http_interceptor#159 |
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey @techouse - I've reviewed your changes and found some issues that need to be addressed.
Blocking issues:
-
Replace DateTime.timestamp() with DateTime.now() to get the current time. (link)
-
Use DateTime.now() instead of DateTime.timestamp() for current time retrieval. (link)
-
Consider grouping related flags within
TalkerHttpLoggerSettings(e.g., print options) to potentially simplify the configuration API. -
Adding the
x-talker-http-logger-tsheader modifies outgoing requests; confirm this behavior is intended and acceptable.
Here's what I looked at during the review
- 🔴 General issues: 2 blocking issues, 3 other issues
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
# Conflicts: # packages/talker_http_logger/CHANGELOG.md # packages/talker_http_logger/README.md # packages/talker_http_logger/pubspec.yaml
….0.0 # Conflicts: # packages/talker_http_logger/CHANGELOG.md # packages/talker_http_logger/README.md # packages/talker_http_logger/pubspec.yaml
# Conflicts: # packages/talker_http_logger/CHANGELOG.md # packages/talker_http_logger/README.md # packages/talker_http_logger/pubspec.yaml
|
@Frezyx I suggest you squash-merge this commit so that it doesn't flood the master commit log. |
# Conflicts: # packages/talker_http_logger/CHANGELOG.md # packages/talker_http_logger/README.md # packages/talker_http_logger/pubspec.yaml
# Conflicts: # packages/talker_http_logger/CHANGELOG.md # packages/talker_http_logger/README.md # packages/talker_http_logger/pubspec.yaml
# Conflicts: # packages/talker_http_logger/CHANGELOG.md # packages/talker_http_logger/pubspec.yaml
This pull request introduces a significant overhaul of the
talker_http_loggerpackage, including updates to its functionality, documentation, and example project. The most important changes involve the migration to thehttp_interceptorpackage, enhancements to the package's logging capabilities, and the addition of a comprehensive example project.Package Overhaul and Feature Enhancements:
httptohttp_interceptorfor HTTP client logging, with updated usage instructions and examples in theREADME.md. New features include customizable log colors, request/response filtering, and the ability to hide sensitive headers. [1] [2] [3]CHANGELOG.mdto reflect the complete overhaul of the package, marking version1.0.0.Developer Tooling and Workflow:
Makefilewith various commands for code analysis, formatting, testing, and dependency management to streamline development workflows.talker_http_logger.yaml) for automated testing of the package on push and pull request events.Example Project:
talker_http_loggerpackage, including setup instructions, customizations, and directory structure documentation.build.gradle.kts,AndroidManifest.xml, and other supporting resources. [1] [2] [3] [4] [5]Documentation and Configuration:
README.mdwith detailed usage instructions, including advanced features like printing cURL commands, hiding sensitive headers, and customizing log colors. [1] [2]analysis_options.yaml) for the example project to enforce linting rules and exclude generated files.These changes collectively modernize the
talker_http_loggerpackage, improve its usability, and provide developers with robust tools and examples to integrate it into their projects.Summary by Sourcery
Complete overhaul of the
talker_http_loggerpackage, introducing comprehensive HTTP logging capabilities with extensive customization optionsNew Features:
Enhancements:
Documentation:
Tests:
Chores: