-
Notifications
You must be signed in to change notification settings - Fork 8k
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 LoggerWithFormatter method #1677
Add LoggerWithFormatter method #1677
Conversation
1eacad4
to
58da85a
Compare
Codecov Report
@@ Coverage Diff @@
## master #1677 +/- ##
========================================
+ Coverage 99.19% 99.4% +0.2%
========================================
Files 41 41
Lines 1995 2017 +22
========================================
+ Hits 1979 2005 +26
+ Misses 12 9 -3
+ Partials 4 3 -1
Continue to review full report at Codecov.
|
@sairoutine Hi, can you see the log middleware https://github.com/gin-contrib/logger ? thanks! |
@thinkerou Also, by this pull request, Your suggested middleware will be the simpler code and it's redundant code will be eliminated. Thanks. |
@sairoutine please commit the whole code which includes unit test and example code, thanks, and then we review. |
ad7235d
to
d7946ec
Compare
d7946ec
to
bae4c3a
Compare
2f1ee78
to
e6bbd22
Compare
@thinkerou |
Thank you for review and merge! |
Problems
I want to define gin's log format.
Currently, instead of using the default Logger, I can define the log format by defining my own Logger function.
However, my own Logger function must include redundant codes similar to the default Logger.
ref. #1581
Proposal
This PR solves the problem by adding new methods,
LoggerWithFormatter
andLoggerWithConfig
.example code
refs.
gorilla's LogFormatter
http://www.gorillatoolkit.org/pkg/handlers#LogFormatter
echo's LoggerWithConfig
https://echo.labstack.com/middleware/logger
At end
If you prefers to this proposal, I will add unit tests and documents.
Thanks.