-
Notifications
You must be signed in to change notification settings - Fork 336
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
feat: format gin logger #904
Conversation
Simply run |
Thanks! |
Codecov Report
@@ Coverage Diff @@
## master #904 +/- ##
==========================================
- Coverage 32.05% 31.86% -0.19%
==========================================
Files 71 72 +1
Lines 7775 7895 +120
==========================================
+ Hits 2492 2516 +24
- Misses 5009 5103 +94
- Partials 274 276 +2
Continue to review full report at Codecov.
|
Please fix this:
Thanks! |
Done |
@lingsamuel, hi lingsamuel, I observed ci error, check the ingress lb status is updated, I don't know what to do to fix it. |
It's a flaky test #869, just ignore it |
pkg/log/gin_logger.go
Outdated
c.Next() | ||
cost := time.Since(start) | ||
|
||
logger.Infof("path: %s, status: %d, method: %s, query: %s, ip: %s, user-agent: %s, errors: %s, cost: %s", |
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.
I am not familiar with gin-gonic, does it have similar concept like log level (like report error when 4XX, 5XX)? wdyt @tao12345666333 ? (this is not a change request)
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.
IIRC it does not provide this ability by default, but it can be achieved by customizing the Log output.
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.
@lingsamuel @tao12345666333 I used error level alone for the return codes of 4xx and 5xx.
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
Please check the CI errors |
@tao12345666333, I have some doubts about the CI error. I can't reproduce it locally. It seems to be an unstable CI unit test. |
@Belyenochi let me re-run CI. |
It seems that everything is ok. |
merged! |
Type of change:
What this PR does / why we need it:
Resolves #899