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,
LoggerWithFormatterandLoggerWithConfig.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.