1
0
mirror of https://github.com/labstack/echo.git synced 2025-12-19 23:52:19 +02:00

Added request logger middleware which helps to use custom logger library for logging requests (#1980)

Added request logger middleware which helps to use custom logger library for logging requests.
This commit is contained in:
Martti T
2021-09-14 20:57:47 +03:00
committed by GitHub
parent 7f502b1ff1
commit 1e7e67cddb
6 changed files with 823 additions and 13 deletions

View File

@@ -357,6 +357,11 @@ func (e *Echo) Routers() map[string]*Router {
// DefaultHTTPErrorHandler is the default HTTP error handler. It sends a JSON response
// with status code.
//
// NOTE: In case errors happens in middleware call-chain that is returning from handler (which did not return an error).
// When handler has already sent response (ala c.JSON()) and there is error in middleware that is returning from
// handler. Then the error that global error handler received will be ignored because we have already "commited" the
// response and status code header has been sent to the client.
func (e *Echo) DefaultHTTPErrorHandler(err error, c Context) {
if c.Response().Committed {