-
Notifications
You must be signed in to change notification settings - Fork 4
feat(reqlog): added WithSkip #47
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
Conversation
Reviewer's Guide by SourceryThis pull request introduces a skip functionality for the request logging middleware by adding a new WithSkip option, which enables conditional bypassing of log messages based on the request context. The changes span test updates, middleware modifications, and documentation improvements. Sequence diagram for WithSkip logic in reqlog middlewaresequenceDiagram
participant C as Client Request
participant M as ReqLog Middleware
participant N as Next Handler
C->>M: Incoming Request
M->>M: Check if SkipFunc is set
alt SkipFunc returns true
M->>N: Call next(c) without logging
else SkipFunc returns false
M->>M: Record start time
M->>N: Call next(c)
M->>M: Log request details
end
Class diagram for Options struct and WithSkip functionclassDiagram
class Options {
+GetVisitor(c: *xun.Context) string
+GetUser(c: *xun.Context) string
+Format: Format
+SkipFunc: func(c: *xun.Context) bool
}
class WithSkip {
+WithSkip(f: func(c: *xun.Context) bool) Option
}
Options --> WithSkip : configured by
note for Options "Added SkipFunc field to support conditional log skipping"
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @cnlangzi - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider adding a benchmark to evaluate the performance impact of the
WithSkip
option.
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.
Here's the code health analysis summary for commits Analysis Summary
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #47 +/- ##
==========================================
+ Coverage 93.02% 93.10% +0.07%
==========================================
Files 49 49
Lines 1892 1899 +7
==========================================
+ Hits 1760 1768 +8
+ Misses 98 97 -1
Partials 34 34
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Changed
Fixed
Added
WithSkip
Tests
Tasks to complete before merging PR:
make unit-test
to check for any regressions 📋make lint
to check for any issuesSummary by Sourcery
New Features:
WithSkip
option to the request logger to allow skipping logging for specific requests.