-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add route to request log #2162
Add route to request log #2162
Conversation
middleware/logger_test.go
Outdated
@@ -91,17 +91,17 @@ func TestLoggerTemplate(t *testing.T) { | |||
e.Use(LoggerWithConfig(LoggerConfig{ | |||
Format: `{"time":"${time_rfc3339_nano}","id":"${id}","remote_ip":"${remote_ip}","host":"${host}","user_agent":"${user_agent}",` + | |||
`"method":"${method}","uri":"${uri}","status":${status}, "latency":${latency},` + | |||
`"latency_human":"${latency_human}","bytes_in":${bytes_in}, "path":"${path}", "referer":"${referer}",` + | |||
`"latency_human":"${latency_human}","bytes_in":${bytes_in}, "path":"${path}", "route":"${route}" "referer":"${referer}",` + |
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.
to be pedantic :) ,
comma is missing between route
and referer
. otherwise this is OK PR
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.
Oh thanks for the good catch, fixed🙏
10a35c5
Codecov ReportBase: 92.20% // Head: 92.69% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #2162 +/- ##
==========================================
+ Coverage 92.20% 92.69% +0.49%
==========================================
Files 37 37
Lines 3090 4462 +1372
==========================================
+ Hits 2849 4136 +1287
- Misses 151 238 +87
+ Partials 90 88 -2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
LGTM
This PR adds
route
to tags used for request logging to be able to log the route pattern.There is a usecase that we want to log the route to aggregate the request in monitoring.